Home   Help Search Login Register  

Author Topic: Handling over actionmenu  (Read 1107 times)

0 Members and 1 Guest are viewing this topic.

Robinhansen

  • Guest
Handling over actionmenu
« on: 19 May 2005, 15:02:21 »
I'm playing some coop mp-games at the moment were each player are in command of up to 12 soldiers pr. platoon. Each commander has severel specific "things" in the actionmenu. Every time the player dies he respawns as the 2IC and so on - Is it possible to handle over these "things" in the actionmenu from the dead commander to the next player :D

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Handling over actionmenu
« Reply #1 on: 22 May 2005, 10:12:09 »
use something like the following script





#START

@! alive leader groupname
remove all the units actions

@ alive leader groupname
_leader = leader groupname
?!(local _leader):exit
_leader addaction.............................. etc etc
goto "START


the use of the @ sign calls for high cpu usage
you could also use the following, more efficient


#START
~0.5
?(! alive leader groupname): goto "REMOVEACTIONS"
goto "START"

#REMOVEACTIONS
remove all the units actions
_leader = leader groupname
?!(local _leader):exit
_leader addaction.............................. etc etc
goto "START"
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Robinhansen

  • Guest
Re:Handling over actionmenu
« Reply #2 on: 31 May 2005, 14:08:21 »
Hm...okay! The group is called grp 14. The "grp14 = group this" tag is written in all the groupmembers initfield but NOT in the leaders field for a reason. The leader is named eng and the actions in the actionmenu is called ability. this is how the players initfield looks like:
Quote
ability = eng addaction ["Engineer abilities", "eng\abilities.sqs"]
and this is how the script looks like
Quote
#START

@! alive leader grp14
removeaction ability

@ alive leader grp14
_leader = leader grp14
?!(local _leader):exit
_leader ability = addaction ["Engnieer abiliies","eng\abilities.sqs"]
goto "START


#START
~0.5
?(! alive leader grp14): goto "REMOVEACTIONS"
goto "START"

#REMOVEACTIONS
removeaction ability
_leader = leader grp14
?!(local _leader):exit
_leader ability = addaction ["Engnieer abiliies","eng\abilities.sqs"]
goto "START"

But when I run the script I get this errormessage:

'removeaction #ability': error unknown operator ability

What shall I do different?
« Last Edit: 31 May 2005, 14:08:57 by Robinhansen »

Offline Garcia

  • Members
  • *
  • Leeds United is the best football team...EVER!
Re:Handling over actionmenu
« Reply #3 on: 31 May 2005, 14:27:44 »
Quote
#START

@! alive (leader grp14)
(leader grp14) removeaction ability

@ alive (leader grp14)
_leader = leader grp14
?!(local _leader):exit
ability = _leader  addaction ["Engnieer abiliies","eng\abilities.sqs"]
goto "START2"


#START2
~0.5
?(! alive (leader grp14)): goto "REMOVEACTIONS"
goto "START2"

#REMOVEACTIONS
_leader removeaction ability
_leader = leader grp14
?!(local _leader):exit
ability = _leader  addaction ["Engnieer abiliies","eng\abilities.sqs"]
goto "START"

There, dunno if I fixed it right :P and don't know if you need all the () around leader grp14, but they don't do any harm :P

1: you can't have "#START" 2 places.
2: to remove a action you gotta use
Quote
unitname removeaction action
so not
Quote
removeaction ability
but
Quote
_leader removeaction ability
3: to add a action you write
Quote
actionname = unitname addaction ["Text","script.sqs"]
so not
Quote
_leader ability = addaction ["Engnieer abiliies","eng\abilities.sqs"]
but
Quote
ability =  _leader addaction ["Engnieer abiliies","eng\abilities.sqs"]

Many quotes :o
Dunno if it's all right, but I hope so :P

oh, and btw, you could only use this part of the script:

Quote
#START
~0.5
?(! alive (leader grp14)): goto "REMOVEACTIONS"
goto "START"

#REMOVEACTIONS
_leader removeaction ability
_leader = leader grp14
?!(local _leader):exit
ability = _leader  addaction ["Engnieer abiliies","eng\abilities.sqs"]
goto "START"

but, since the script exits for everyone who is not leader (?!(local _leader):exit), the script won't work when the new leader dies...cause then the script would only run on the leader, and when he dies, the script exits from him too, and it doesn't run anymore...bah, actions in MP sucks :-\
« Last Edit: 31 May 2005, 14:34:08 by Garcia »