Jump to content
Sign in to follow this  
NaveReyem

CreateUnit problems

Recommended Posts

Hello all, i would respectfully request that someone assist me in a problem i am having...

I need to know how to create a unit, and in the units INIT field that was just created execute a file, like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this] exec "newunits.sqs"

Because when i get the unit to spawn, he lays down and doesnt do anything that was scripted in newunits.sqs

help plz wink_o.gif

EDIT :

ohh yeah i forgot to say that i used a variable for the INIT

something like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

zinit = [this] exec "newunits.sqs", this setunitpos "UP", removeallweapons this

"Civilian" createunit [[0,0,0], cgroup, "zinit"]

coming up off the top of my head with that, the unit spawns and such, but i dont think he executes the newunits.sqs, or stand up... help plz

Share this post


Link to post
Share on other sites

thank you mate, never thought of using {newunits.sqs} instead of "" marks, i tested it like with the "" and it thinks that the end ot the init, making an error, i hope this works....

Share this post


Link to post
Share on other sites

sorry for doublepost, but i have another question....

ok, heres an example of the situation....

I want to replace a dead unit with another createdunit of the same type.....

how would i do this?

Share this post


Link to post
Share on other sites

The first thing that comes to mind is to give each of your units a {killed} Event Handler that would create a unit of the same type at that location.

Share this post


Link to post
Share on other sites

this would be for multiplayer (no event handlers), and i already have a script that detects who is killed and when they die, i just need to know how to use a command like typeOf but i have no idea, soooo....

Share this post


Link to post
Share on other sites
this would be for multiplayer (no event handlers), and i already have a script that detects who is killed and when they die, i just need to know how to use a command like typeOf but i have no idea, soooo....

why no eventhandlers? Eventhandlers work just fine in multiplayer.

Share this post


Link to post
Share on other sites

Well, I've been told that eventhandlers ain't a big problem in MP, and I've used them without any problem (or at least I'm pretty sure I've had no problem with them tounge2.gif )

Share this post


Link to post
Share on other sites

lets get back to the real question please, ive got TypeOf to figure out what kind of unit the _z is, but i dont know how to use createunit with the information, i put the info onto a variable and made it "_zsapwner" createunit [suchandsuch]

but it didnt work, sayd bad unit _zsapwner or something.... confused_o.gif

Share this post


Link to post
Share on other sites

try

_zspawner createunit [suchandsuch]

"_zpspawner" makes a string out of your variable.And theres no unit called "_zspawner".

The unit type you stored in _zspawner comes with "" already.

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  

×