NaveReyem 0 Posted October 7, 2005 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 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
thobson 38 Posted October 7, 2005 This will give you some examples and explanation on createUnit: http://www.ofpec.com/editors/comref.php?letter=C#createUnit See particularly the second comment by macguba where: "this addweapon {binocular}" is the init field for the unit. Share this post Link to post Share on other sites
NaveReyem 0 Posted October 7, 2005 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
NaveReyem 0 Posted October 7, 2005 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
thobson 38 Posted October 7, 2005 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
NaveReyem 0 Posted October 9, 2005 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
thobson 38 Posted October 9, 2005 Try this: http://www.ofpec.com/editors/comref.php?letter=T#typeOf In fact the whole document is worth a read. Share this post Link to post Share on other sites
Garcia 0 Posted October 9, 2005 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
NaveReyem 0 Posted October 9, 2005 k, i read somewhere that NEVER use evanthandlers, lol. Share this post Link to post Share on other sites
Garcia 0 Posted October 10, 2005 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 ) Share this post Link to post Share on other sites
NaveReyem 0 Posted October 11, 2005 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.... Share this post Link to post Share on other sites
Trapper 0 Posted October 11, 2005 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
NaveReyem 0 Posted October 11, 2005 OHh i didnt know that, thank you! Share this post Link to post Share on other sites