Home   Help Search Login Register  

Author Topic: how to preserve script on respawn ...  (Read 972 times)

0 Members and 1 Guest are viewing this topic.

duckwilliamson

  • Guest
how to preserve script on respawn ...
« on: 19 Sep 2003, 21:18:35 »
My problem comes from this:

-I have a script called "lockwp.sqs"
-I execute it through wp's by having no condition but only an activation of
Code: [Select]
[0] exec "lockwp.sqs"-The number is the part of the script to jump to that has the conditions
-The conditions consist of something like @player ammo "pipebomb" > 0
-Here's the script:
Code: [Select]
player lockwp true
_part=_this select 0
?_part==0:goto "p0"
#p0
@player ammo "pipebomb">0
player lockwp false
exit
-There are 10 parts - this is just one ...
-Now if I hit the activation so that this script is running and waiting for me to pick up the satchels - but i don't and die instead then the script no longer recognizes me as player so the @player has stopped working (i think) meaning that the wp won't ever unlock
-The script works fine if I don't die while it's running ...

Can anyone help me?
I figure the problem is having to deal with a script that time's out because I have put arguments into it
I can rewrite it so that it requires no arguments - but i think that the problem is where the @player times out ...
I appreciate any comments and help ...
« Last Edit: 19 Sep 2003, 21:23:45 by PointBlank{KFR} »

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:how to preserve script on respawn ...
« Reply #1 on: 19 Sep 2003, 21:29:08 »
You can pass the owner of the WP in the exec line with this.
You can check the status of the unit that is the owner of the WP:
_stage = _this select 0
_unit = _this select 1
goto format ["%1",_stage]

#0
@ (! alive _unit) || (IsNull _unit)
do stuff

So that might be the correct way in MP, but still very sketchy. Also you can use format instead of multiple ? lines (goto format ["%1",_stage]). Not sure if a timeout in fact exists. Also using WPs in MP is very unreliable as circumstances might lead the player way away from them  ;)
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

duckwilliamson

  • Guest
Re:how to preserve script on respawn ...
« Reply #2 on: 26 Sep 2003, 04:40:35 »
ok ... i found my problem ... it has to do with the player dying ...

- when a player dies, the player variable and all temp variables within that script that relied on the player variable dissolve
- i fixed this by adding a @!alive : exit the script
- i then added a @alive : exec script again ...
- by doing this all variables that were involved in the script were refreshed once the person was alive again ...

so i've fixed my problem and thanks to MI-Fred for helping ...