tonitoni1998
Member
Posts: 163
Threads: 54
Joined: Oct 2012
Reputation:
1
|
"if" help ( again -_-'' )
void CompleteOilQuest(string &in asEntity)
{
CompleteQuest("oil_quest", "Quest_OilQuest_Text");
if(GetPlayerLampOil == 0f)
{
SetMessage("map2_messages", "QuestOilDone1");
}
else if(GetPlayerLampOil > 0f && (GetPlayerLampOil) <= 5f)
{
SetMessage("map2_messages", "QuestOilDone2");
}
else if(GetPlayerLampOil > 5f && (GetPlayerLampOil) < 12.5f)
{
SetMessage("map2_messages", "QuestOilDone3");
}
else if(GetPlayerLampOil == 12.5f)
{
SetMessage("map2_messages", "QuestOilDone4");
}
}
i always get error messages ( http://imgur.com/aW6BhjZ ) here. where is my problem? it doesnt look different in the wiki.
thanks
When you are looking for someone, to do the scripting for your Custom Story, ask me!
(This post was last modified: 02-20-2013, 07:15 PM by tonitoni1998.)
|
|
02-20-2013, 06:13 PM |
|
OriginalUsername
Posting Freak
Posts: 896
Threads: 42
Joined: Feb 2013
Reputation:
34
|
RE: "if" help ( again -_-'' )
void CompleteOilQuest(string &in asEntity)
{
CompleteQuest("oil_quest", "Quest_OilQuest_Text");
if(GetPlayerLampOil == 0f)
{
SetMessage("map2_messages", "QuestOilDone1");
}
else
{
if(GetPlayerLampOil > 0f && (GetPlayerLampOil) <= 5f)
{
SetMessage("map2_messages", "QuestOilDone2");
}
else
{
if(GetPlayerLampOil > 5f && (GetPlayerLampOil) < 12.5f)
{
SetMessage("map2_messages", "QuestOilDone3");
}
else
{
if(GetPlayerLampOil == 12.5f)
{
SetMessage("map2_messages", "QuestOilDone4");
}
}}}}
That should do it. I'm not sure though
|
|
02-20-2013, 06:39 PM |
|
tonitoni1998
Member
Posts: 163
Threads: 54
Joined: Oct 2012
Reputation:
1
|
RE: "if" help ( again -_-'' )
nope. sr doesnt work :/
When you are looking for someone, to do the scripting for your Custom Story, ask me!
|
|
02-20-2013, 06:57 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: "if" help ( again -_-'' )
It should be 'GetPlayerLampOil() == 0' etc, instead of 'GetPlayerLampOil== 0' etc...
Also, if you could say what your trying to do, and the error that comes up when you try it, that would be very helpful for us
|
|
02-20-2013, 06:57 PM |
|
tonitoni1998
Member
Posts: 163
Threads: 54
Joined: Oct 2012
Reputation:
1
|
RE: "if" help ( again -_-'' )
i already tried it
the player gets a quest when he picks up a lantern (that will give him 12.5 oil). this quest leads him to the basement where he will look for some more oil. when he is at the basement and picks the oil up, he will get a message that variates depending on how much oil he has left. (0, between 0 and 5, between 5 and 12.5, and 12.5)
my error message looks like this:
http://imgur.com/aW6BhjZ
When you are looking for someone, to do the scripting for your Custom Story, ask me!
(This post was last modified: 02-20-2013, 07:10 PM by tonitoni1998.)
|
|
02-20-2013, 07:09 PM |
|
xxxxxxxxxxxxxxxx
Posting Freak
Posts: 935
Threads: 0
Joined: Jun 2012
Reputation:
54
|
RE: "if" help ( again -_-'' )
I'm not really good at scripting myself, so I'm not sure if I can really help. But I noticed that sometimes you're putting GetPlayerLampOil() in separate brackets and sometimes you don't. Any special reason for that? It seems to be exactly the lines that throw errors.
So maybe try this:
void CompleteOilQuest(string &in asEntity)
{
CompleteQuest("oil_quest", "Quest_OilQuest_Text");
if(GetPlayerLampOil() == 0f)
{
SetMessage("map2_messages", "QuestOilDone1");
}
else if(GetPlayerLampOil() > 0f && GetPlayerLampOil() <= 5f)
{
SetMessage("map2_messages", "QuestOilDone2");
}
else if(GetPlayerLampOil() > 5f && GetPlayerLampOil() < 12.5f)
{
SetMessage("map2_messages", "QuestOilDone3");
}
else if(GetPlayerLampOil() == 12.5f)
{
SetMessage("map2_messages", "QuestOilDone4");
}
}
|
|
02-20-2013, 09:17 PM |
|
MulleDK19
Senior Member
Posts: 545
Threads: 21
Joined: Jun 2009
Reputation:
10
|
RE: "if" help ( again -_-'' )
0f or 5f is not valid. You must use 0.0f and 5.0f.
|
|
02-20-2013, 11:20 PM |
|
NaxEla
Senior Member
Posts: 415
Threads: 5
Joined: Dec 2012
Reputation:
28
|
RE: "if" help ( again -_-'' )
void CompleteOilQuest(string &in asEntity) { CompleteQuest("oil_quest", "Quest_OilQuest_Text"); if(GetPlayerLampOil() == 0.0f) { SetMessage("map2_messages", "QuestOilDone1"); } if(GetPlayerLampOil() > 0.0f && GetPlayerLampOil() <= 5.0f) { SetMessage("map2_messages", "QuestOilDone2"); } if(GetPlayerLampOil() > 5.0f && GetPlayerLampOil() < 12.5f) { SetMessage("map2_messages", "QuestOilDone3"); } if(GetPlayerLampOil() == 12.5f) { SetMessage("map2_messages", "QuestOilDone4"); } }
Try that code.
Btw, does the quest actually get completed? Because if you called the quest "OilQuest", writing "Quest_OilQuest_Text" in this line: CompleteQuest("oil_quest", "Quest_OilQuest_Text");
will not work. It should just be: CompleteQuest("oil_quest", "OilQuest");
|
|
02-21-2013, 12:49 AM |
|
tonitoni1998
Member
Posts: 163
Threads: 54
Joined: Oct 2012
Reputation:
1
|
RE: "if" help ( again -_-'' )
okay guys it works now ^^ i just did everything you said and now it works. if i can help someone with this: this is what it looks like now
void CompleteOilQuest(string &in asEntity)
{
CompleteQuest("oil_quest", "OilQuest");
AddPlayerSanity(30);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
if(GetPlayerLampOil() == 0.0f)
{
SetMessage("map2_messages", "OilQuestDone1", 5.0f);
}
else if(GetPlayerLampOil() > 0.0f && GetPlayerLampOil() <= 5.0f)
{
SetMessage("map2_messages", "OilQuestDone2", 5.0f);
}
else if(GetPlayerLampOil() > 5.0f && GetPlayerLampOil() < 12.5f)
{
SetMessage("map2_messages", "OilQuestDone3", 5.0f);
}
else if(GetPlayerLampOil() == 12.5f)
{
SetMessage("map2_messages", "OilQuestDone4", 5.0f);
}
}
thanks for the help
When you are looking for someone, to do the scripting for your Custom Story, ask me!
|
|
02-21-2013, 05:42 PM |
|
|