Jump to content
Sign in to follow this  
Arska134

Create soldiers with trigger problem

Recommended Posts

Hi i just started making missions in Operation Flashpoint Resistance.

I tried to make trigger what is inside of tent and when west soldier touches the trigger, new west soldier AI is made. I tried this, but i got error when i load my mission.

Mission.sqm

class Item5
{
	position[]={5114.778809,21.542013,12328.648438};
	a=2.000000;
	b=2.000000;
	rectangular=1;
	activationBy="WEST";
	activationType="WEST D";
	repeating=1;
	age="UNKNOWN";
	name="traintrigger";
	class Effects
	{
			voice="Eng20";
			"SoldierWB" createUnit [position player, group player]
	};
};

So my game shuts down and i get this:

ghg.png

So i am making Arma 2 Domination AI style mission.

...and sorry my bad english. :D

Share this post


Link to post
Share on other sites

Ok i solved the problem. It works if i put it in "on activation", but if i but it manually to script it won't work.

So now i have new problem. Unit is created and it joins in my group, but all players got unit to their squads.

So how i can spawn only one AI for player who train that soldier. Not for everyone. And how i check how many units are in my squad. (if over 8 units, can't train soldiers)

Share this post


Link to post
Share on other sites

All players got units on their squad because you put "group player"

The Trigger sincronize the command to all players, so try with this script "on activation"

[thislist] exec "NewUnit.sqs"

You need to set the groups on the init of the leader, like

group1=group this

group2=group this

And, the server gamelogic placed on the mission.

Save this script on the main directory of your mission.

;NewUnit.sqs

;Variables
_groupnew = 0
_posnew = 0

;Check if the player is in the trigger, and not a simple AI
? (player in thislist): goto "checkgroup"
exit

;Check the group that is purchasing the new troop and if its the leader, and the number of units in the groups
#checkgroup
? (leader group1 in thislist and count units group1 < 8): _groupnew = group1; _posnew = position leader group1; goto "create"
? (leader group2 in thislist and count units group2 < 8): _groupnew = group2; _posnew = position leader group2; goto "create"
server sidechat ">>> HQ: You have more than 8 units <<<"
exit

;And keep adding more if you have more groups that can purchase units

;Create the unit
#create
"SoldierWB" createUnit [_posnew,_groupnew]
exit

It should work, I haven't tested it =P.

Ah, and i forgot your second question, editing.

Edited by NacroxNicke

Share this post


Link to post
Share on other sites

The easier way is to write in trigger condition:

player in thislist && count units group player < 8

And don't touch the mission.sqm file.

Share this post


Link to post
Share on other sites
All players got units on their squad because you put "group player"

The Trigger sincronize the command to all players, so try with this script "on activation"

[thislist] exec "NewUnit.sqs"

You need to set the groups on the init of the leader, like

group1=group this

group2=group this

And, the server gamelogic placed on the mission.

Save this script on the main directory of your mission.

...

It should work, I haven't tested it =P.

Ah, and i forgot your second question, editing.

So, i saved code in my mission folder as "newunit.sqs". I have trigger inside of tent. I put [thislist] exec "newunit.sqs" inside of triggers "on activation".

I step inside of tent and trigger activates ("go, go, go" voice). Put nothing else happens. I forgot something?

Share this post


Link to post
Share on other sites

You have to set in the init of the leader (player I think) this:

group1=group this

And "group2=group this" for the second group, and if you have a thirst one, you need to edit the script and add a new:

? (leader group3 in thislist and count units group3 < 8): _groupnew = group3; _posnew = position leader group3; goto "create"

And obviously put in the init of the third group leader "group3=group this"

This is mainly for not spawn a unit on every group commanded by a player

Edited by NacroxNicke

Share this post


Link to post
Share on other sites
You have to set in the init of the leader (player I think) this:

group1=group this

And "group2=group this" for the second group, and if you have a thirst one, you need to edit the script and add a new:

? (leader group3 in thislist and count units group3 < 8): _groupnew = group3; _posnew = position leader group3; goto "create"

And obviously put in the init of the third group leader "group3=group this"

This is mainly for not spawn a unit on every group commanded by a player

Thanks it worked! :yay:

I ask one question in this topic because i don't want spam too many topics for my small questions.

So i am making vehicle repair script but i got some errors, again.

There is a script:

http://paste.im2clan.com/index.php?id=16272652934c4da5a031827

When i start mission in editor i got this:

_repair= this addAction ["Repair", "testi.sqs"];|#|´: Error Local Variable in global space

And this comes always when i try to fix vehicle:

´|#|}; ´: Error Invalid number in experssion

offtopic: Is there IRC channel for Operation Flashpoint problems?

Share this post


Link to post
Share on other sites

Local Variable in global space, hmm, I remember that problem, it's really simple

You miss a _ before the "this"

It's " _repair = _this addaction ["Repair", "testi.sqs"]; "

Share this post


Link to post
Share on other sites

Ok i start new topic because all of this is offtopic :D

Edited by Arska134

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  

×