Forum Jump :

Author Message


Posts: 1
Rank:


Level: Member

Country: 00
Location:
Occupation:
Age:
In-game name: Celery

 
#1 Posted at 2006-12-10 10:06        
     
I'm looking for a way to have a script go forward only when the unit running the script fires his weapon.

Something like:

@*unit fires*

The only thing is that I lack the words to write such a line. @_unit action ["FIRE"] does nothing. Please help! :blush


Author Message

Big  

Armaholic icons master


Posts: 5559
Rank:


Level: Former Staff

Country: es
Location: Who knows
Occupation: Industrial Engineer
Age: 44
In-game name:

 
#2 Posted at 2006-12-10 16:32        
     
I cant help u, fox will comeback tomorrow and he will be able to help u for sure.
Or maybe other one knows about scripting?


Advertisement


Author Message

sunraa  

Beef Jerky ... yo!


Posts: 456
Rank:


Level: Super Admin

Country: si
Location:
Occupation: sunraa
Age: 39
In-game name:

 
#3 Posted at 2006-12-10 19:31        
     
You will have to use an eventhandler.
At the moment I dont have acces to any of my files for scripting, but monday I will post a script here so everytime a unit fires his weapon a script will start.


Author Message


Posts: 20660
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 44
In-game name: Foxhound

 
#4 Posted at 2006-12-11 18:56        
     
Ok, I am home again (and sober) :), so I can now give you a very easy explanation of how to add that script.

First you need a script which will execute and perform the action you want. So below I make an example script, you can just change it to whatever you need.

;eventhandler action
;put this in the unit init field
;this addeventhandler [{fired},{_this exec "snipe.sqs"}]

;Will make unit switch stance after each shot and stop firing for a random amount of time (min 5 secs and max 10).

_unit = _this select 0
_unit setunitpos "down"
_unit setcombatmode "blue"

~5 + random 5
_unit setunitpos "up"
_unit SetCombatMode "yellow"
exit

Make sure to add this code:
this addeventhandler [{fired},{_this exec "snipe.sqs"}]
in the init of each unit you want to perform the action when they fire.
There are more eventhandler triggers so you might want to take a look here.

Visit my family webshop desteigerhoutshop.nl.