Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"if" help ( again -_-'' )
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#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
Find
OriginalUsername Offline
Posting Freak

Posts: 896
Threads: 42
Joined: Feb 2013
Reputation: 34
#2
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
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#3
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#4
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
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#5
RE: "if" help ( again -_-'' )

i already tried it Sad

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
Find
xxxxxxxxxxxxxxxx Away
Posting Freak

Posts: 935
Threads: 0
Joined: Jun 2012
Reputation: 54
#6
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
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#7
RE: "if" help ( again -_-'' )

0f or 5f is not valid. You must use 0.0f and 5.0f.

[Image: 16455.png]
02-20-2013, 11:20 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#8
RE: "if" help ( again -_-'' )

PHP Code: (Select All)
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");

In Ruins [WIP]
02-21-2013, 12:49 AM
Find
tonitoni1998 Offline
Member

Posts: 163
Threads: 54
Joined: Oct 2012
Reputation: 1
#9
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 Smile

When you are looking for someone, to do the scripting for your Custom Story, ask me!
02-21-2013, 05:42 PM
Find




Users browsing this thread: 1 Guest(s)