ooblikai Posted May 6, 2010 Share Posted May 6, 2010 Is there a way to set multiple if statements? Because I cannot figure out how to do it. I'm trying to do multiple if ref.GetDead == 1 's to set a quest stage. It works with one, but I cant get any more than that. thanks. Link to comment Share on other sites More sharing options...
anlashok Posted May 6, 2010 Share Posted May 6, 2010 Is there a way to set multiple if statements? Because I cannot figure out how to do it. I'm trying to do multiple if ref.GetDead == 1 's to set a quest stage. It works with one, but I cant get any more than that. thanks. Ifif var1 == x && var2 == ynorif var1 == x AND var2 == ywork, try this: if var1 == x if var2 == y do stuff here endif endif Hope this helps. Edit:While this post is in its simplicity quite embarrassing, I'm going to leave it here nevertheless. The post below explains everything much better. Link to comment Share on other sites More sharing options...
ric36 Posted May 6, 2010 Share Posted May 6, 2010 Depends on what you are trying to do. Inclusivel or exclusively If you want to check to see if all refs are dead then if ref1.GetDead == 1 && ref2.GetDead == 1 && ref3.GetDead == 1 ; etc do something hereendif If you want to do something is any ref is dead then if ref1.GetDead == 1 || ref2.GetDead ==1 || ref3.GetDead ==1 ; etc do something hereendif If you want to check the next ref if the first ref is not dead for example then you can else it if ref1.GetDead == 1 do something hereelseif ref2.GetDead == 1 do something hereelseif ref3.GetDead == 1 do something hereelse ; if you want a default action when no refs are dead, the else is optional do default action hereendif As highlighted above, you can nest ifs ultimately if you have a bunch of checks and you want them all to run thenif ref1.GetDead == 1 do something hereendif if ref2.GetDead == 1 do something hereendif etc. RegardsRic36 Link to comment Share on other sites More sharing options...
BadPenney Posted May 6, 2010 Share Posted May 6, 2010 One point: It is unnecessary to write ==1 in these cases. It is redundant in getdead because it is an either/or situation, not an item count. So If you want your quest to advance a stage after 3 NPCs are dead, for instance, then you could write: Begin Gamemode if Tom.GetDead && Richard.GetDead && Harry.GetDead SetStage MyQuest 30 endif End It would have the same effect as writing GetDead == 1 each time. The 1 is implied. Link to comment Share on other sites More sharing options...
ooblikai Posted May 9, 2010 Author Share Posted May 9, 2010 Thanks everyone. This will clean my scripts a lot. Link to comment Share on other sites More sharing options...
Recommended Posts