OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcus3 on 30 Dec 2005, 19:07:11
-
i have a script ( will show in post) that is supposed to make the troops have some idle talk, i want it to be so they say differnt things, anywas here is the script
_yada = random 3
?(_yada == 1) : goto "talk1"
?(_yada == 2) : goto "talk2"
?(_yada == 3) : goto "talk3"
#talk1
titlecut ["Soldier - Man its cold!","PLAIN DOWN",1]
?(talk == 0) : exit
~4
titlecut ["Soldier - Stop whineing!","PLAIN DOWN",1]
?(talk == 0) : exit
~4
exit
#talk2
titlecut ["Soldier - I wonder when this will all be over....","PLAIN DOWN",1]
?(talk == 0) : exit
~4
titlecut ["Soldier - When the russian dogs are gone!","PLAIN DOWN",1]
?(talk == 0) : exit
~4
exit
#talk3
titlecut ["Soldier - I am hungrey","PLAIN DOWN",1]
?(talk == 0) : goto "fix"
~4
titlecut ["Soldier - Dont you ever think about something else then food?","PLAIN DOWN",1]
?(talk == 0) : goto "fix"
~4
exit
#fix
exit
the talk varible is used so when u the player walks away the talking stops
anywas, i keep getting the top message, i have tryed doing this befor but, i still cant get it :P
thanks
-
Random doesn't return an exact integer number (well, very rarely).
You need to use mod to strip away the decimal portion to arrive at a whole integer.
Instead of:
_yada = random 3
?(_yada == 1) : goto "talk1"
?(_yada == 2) : goto "talk2"
?(_yada == 3) : goto "talk3"
Try:
#top
_rnum = random 4 ; _yada = _rnum - (_rnum mod 1)
?(_yada == 1) : goto "talk1"
?(_yada == 2) : goto "talk2"
?(_yada == 3) : goto "talk3"
?(_yada == 4) : goto "top"
Something like that anyway
Planck
-
awsome, it works, thanks planck! ;D