OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ThEoNeAnDoNlY on 26 Feb 2005, 14:25:20

Title: problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 14:25:20


hello, im running this script.

Quote
player playmove "Combattomedic"

~5

sandbag setpos [(getpos player select 0)+0,(getpos player select 0)+4,0]

~3

exit

but when the script is activate the sandbag dsnt appear infrontof me, instead it dissapears!!!!!!

Guy
Title: Re:problem with script
Post by: THobson on 26 Feb 2005, 14:27:18
Your second select 0 should be select 1

That will then place the sandbag 4 m to the north of the player's posisiton.
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 15:36:38
ok, with that sorted how do i set the FOV of the sandbag?

Guy
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 15:40:59
ok change that, how do i get it so it is infront of me, instead it is always to the north of the player, how do i get it to be set infront of me no matter where i am looking.

guy
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 15:53:31
ok ok ok, im using my old script

Quote
~3
_dir = getDir player
_pos = getPos player

; optional direction change of 'bang'
bang setDir _dir

; place infront of the player
bang setPos [(_pos select 0)+(sin _dir), (_pos select 1)+(cos _dir), 0]
~3

but when i do that the sandbag appears at my feet and so the player gets abit stuck, so how do the then add to it to place it 4 ft infront of me

Guy
Title: Re:problem with script
Post by: THobson on 26 Feb 2005, 16:33:16
_dist = 2.5

bang setPos [(_pos select 0)+_dist*(sin _dir), (_pos select 1)+_dist*(cos _dir), 0]
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 17:02:58
ok put that and it says:

sandbag setPos [(_pos select 0)+(sin _dir), (_pos select 1)+_dist|#|(cos _dir), 0]

unknown operator

Guy
Title: Re:problem with script
Post by: Planck on 26 Feb 2005, 17:08:55
Have you initialised the variable _dist anywhere?


Planck
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 26 Feb 2005, 17:09:47
oh no it works now, i forgot to put the > * <

btw what does * mean???

Guy
Title: Re:problem with script
Post by: Planck on 26 Feb 2005, 17:26:24
'*' means ........multiply

So 2*2 would mean 2 multiplied by 2



Planck
Title: Re:problem with script
Post by: ThEoNeAnDoNlY on 27 Feb 2005, 14:02:20
ahh cheers planck, btw does anyone here know how to speed up a;

Quote
(count units gr1 == 0) && (count units gr2 == 0)

script? when i put something liekt hat it always takes ages to trigger, so when i clear out a village for example, i am waiting about5  mins until the game realises everyone is dead.

Guy
Title: Re:problem with script
Post by: Sui on 28 Feb 2005, 04:41:14
That's because the count command relies on the leader knowing about the unit being dead.
Like when you're playing and you get all the "Oh no, 3 is down" radio messages.
Sometimes it takes a while to trigger.

Try this instead:

(West countside units gr1 == 0) and (West countside units gr2 == 0)

Obviously if the side of the units isn't west then change that to east or resistance ;)