Jump to content

Sign in to follow this  
Kabolte

Need some help with addAction

Recommended Posts

So I basically have a simple script that spawns a unit and adds an action to him. The action appears, but when I try to use it, it does nothing. Here are the scripts.

//creates one guerrilla soldier
group1 = createGroup Resistance;
this1 = group1 createUnit ["GUE_Soldier_1",getMarkerPos "spawnKUMYRNA1",[],0,"NONE"];
//adds action to recruit him
this1 addaction ["Recruit","/interaction/recruitLvl1Kumyrna.sqf"];

recruitLvl1Kumyrna.sqf

this join player;

I'm trying to make it as simple as I can, but even then I can't get it to work? What did I do wrong?

Share this post


Link to post
Share on other sites

Try:

(_this select 0) join player

"this" won't do what you think it does.

Share this post


Link to post
Share on other sites

unit addaction ["action", "the sqf."];

Hope that helps.

EDIT:

sorry just re-read your post. should be...

[this1] join player;

Edited by Redfield-77

Share this post


Link to post
Share on other sites

Is there anyway to make it apply to any unit that calls that script, not just this1? If I did it that way, I'd need a ton of files for each unit I'm making that I will be able to recruit.

Share this post


Link to post
Share on other sites

How do you plan to call the script? by placing addaction on each unit? or a different way?

I want to say:

[this] join player;

could be used as a universal sqf. that any unit could call via addaction but im probly wrong. Best if somone with skills answers your question. Meanwhile try it this way.

Share this post


Link to post
Share on other sites
  Kabolte said:
Is there anyway to make it apply to any unit that calls that script, not just this1? If I did it that way, I'd need a ton of files for each unit I'm making that I will be able to recruit.

_activated = _this select 0;
_activator = _this select 1;

_activated join _activator;

Should work, yes?

Share this post


Link to post
Share on other sites

When I enter a trigger, it executes that first script I posted. So I guess yes, by placing addaction on each unit. Using [this1] works fine, but using [this] instead doesn't.

Share this post


Link to post
Share on other sites
  Quote
_activated join _activator
  Quote
(_this select 0) join player

Remember that join requires an array of units. Add square brackets to either of these and they'll work just fine.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×