Aller au contenu

Photo

Need one of you Script gods


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
christinetooley

christinetooley
  • Members
  • 58 messages
I modified this script from user KROM and wanna change it somewhat. First of all, its a starvation counter that slowly
counts down from 100%. When you eat  food_item the counter is supposed to go up a few points but it doesnt...can someone see whats the prob? Also, I'd like to make it able to subtract 1 CON point from Char if they dont eat and the score is at 0%. Thanks in advance. I know you guys like a challenge.
Heres the script:


void
main() {

                object oPC = GetItemActivator();           

                object item =
GetItemActivated();

                string tag = GetTag(item);

                if(tag == "food_item")
{

                                float food =
GetLocalFloat(oPC, "food_counter");

                                food = (food
> 0.75) ? 1.0 : food + GetLocalFloat(item, "food_value");

                                SetLocalFloat(oPC,
"food_counter", food);

Modifié par christinetooley, 28 janvier 2011 - 01:19 .


#2
Morbane

Morbane
  • Members
  • 1 883 messages
your script, as it is posted seems to be incomplete.



Please check all the {'s and }'s and repost - I just want to be sure the correct edits I or anyone else are making will work properly.



Mor

#3
MasterChanger

MasterChanger
  • Members
  • 686 messages
And two more quick pointers: if you put your script in code tags it will maintain formatting when you post it here. Use "code" surrounded by square brackets (they share your { } keys) at the beginning and "/code" with square brackets at the end.

Also, the first thing to do when debugging is to make sure that your script is being called at all--it may not be correctly attached to an event. Have it send you a message:
object oPC = GetFirstPC();
SendMessageToPC(oPC, "We're in starving_script.");

...or some variation on that.

#4
christinetooley

christinetooley
  • Members
  • 58 messages
OK, sorry, I just did a quick copy/paste for the script. Figured y'all would know what to make of it. Im no scripter by a long shot, but if I use MasterChangers starving script idea then how do i build a script that would start draining CON when the food_counter reaches 0% ?

#5
Morbane

Morbane
  • Members
  • 1 883 messages
Master Changer just suggested you put in a test that will display a message (We're in starving_script) when the script is called. That way you will know if the script is actually firing off at all.

You can copy / paste his code to the top of your script then test it in game and look to see if the message appears in the dialog box.

Don't forget to compile the script and save the project before testing..

Modifié par Morbane, 28 janvier 2011 - 10:51 .