OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Crook on 24 Sep 2004, 05:32:24
-
Is there a way to work out something to make sure a play doesn't stay in the same spot for more than 45 seconds?
Say someone arrives a bush and he stays there for a minute waiting for people. Is there a way to script something to add dammage to that player until he moves?
-
I'm assuming this is gonna be a tough one to crack...
-
I'm assuming this is gonna be a tough one to crack...
Why?
I don't suppose it would be hard. A wee looping script ... this is just a crude sketch. Syntax not guaranteed. I'm not familiar with the subtleties of scripting in MP so there may be some glaring errors here, but scripts are local so you could run one for each player on his own comp. I dunno about hints though.
#loop
? not alive player1 : exit
_pos = getPos player1
~45
? (_pos distance player1) < 5 : hint "Move!"; goto "death"
goto "loop"
#death
player1 setDammage (getDammage player1 + 0.05)
hint "You are dying"
~5
? _pos distance player1 < 5 : goto "death"
goto "loop"
-
And you can add checks like
?speed player < 1
to determine if the player is actually moving and not just turning around..
Also you could setpos a trigger with 10x10 radious to the players position and check if the player is in it's area after a while. If he is, then damage him, if not, then setpos the trigger again to his position and start over.
-
worked on this all morning and here is what I have come up with:
;;Campbuster.sqs
;;created by Zombie
_boyscout = _this select 0
_punisher = "heat73"
#start
?!(alive _boyscout):goto "end"
;;the next 2 lines get the players position
_aa = getpos _boyscout select 0
_bb = getpos _boyscout select 1
;;the next gives him 5 seconds to move, change to whatever value you like
~5
;;the next 2 lines get his pos after the delay
_dd = getpos _boyscout select 0
_ee = getpos _boyscout select 1
;;the next 2 check if he has moved
_n =(_aa - _dd)
_e =(_bb - _ee)
;;next line for troubleshooting purposes
_boyscout sidechat format ["%1, %2 ", abs _n, abs _e]
;;next line checks if you have a camper
? (abs _n <= 2) and (abs _e <= 2) :goto "camper"
goto "start"
#camper
_boyscout groupchat "I'm camping! I better move it!"
;;next line gets the punisher ready
_pp = getpos _boyscout
;;next line is the punisher delay, change to whatever you like
~5
;;the next line is the punishment
_punisher = "heat73" camcreate _pp
goto "start"
#end
exit
the script is called by a global trigger for every unit defined as follows:
axis a 0
axis b 0
activation none
repeatedly
condition alive unitname
on activation [unitname] exec "campbuster.sqs"
you need to have every unit you want to campbust named, and need a create a trigger for each of them
if there is a unit you don't want to campbust, like a sniper for instance, just don't create a trigger for him
this is untested in MP, but I see no reason why it wouldn't work, but it may cause some lag
-
--condition : alive unitname This means that the script will execute time after time,(Howmany times does a trigger checks each second,2-3 times?),for every unit,and will add alot of stress.
As this is MP,there are certain areas U dont have to check (Spawnzones),maybe it could be a better idea to have 1 trigger covering the batllefield.This will already reduce the amount of executions of your script.
Condition: Alive Player and player in thislist
And maybe some more conditions to reduce the stress;
**speed player < 1 (only exec when U stop running)
**!player in vehicle (U dont want tanks keep on driving heh,too much dust :P)
**dammage player == 0 (If U are wounded and U have to move (crawl) U cant shoot (play)anymore,U might aswell die ;))
--Camcreate "heat73" :This could have a nasty side effect,it can kill players in the neighbourhood (indirect dammage).Guess some wont like it :P Maybe a better idea to use "setdammage" for the punishment.
--_boyscout groupchat "I'm camping! I better move it!" :This is not correct info,there is no positioncheck after,he is doomed ;D the punishment will follow in 5 sec.
Or _boyscout groupchat "I'm camping! I deserve death :-O)" or another pos check is needed.
Erm,NOTHING guaranteed ;D