Jump to content
Sign in to follow this  
mrbean1112

Okay i've been having this problem all morning

Recommended Posts

Oh My god... I have spent all morning searching, testing, and failing at making this thing work.. okay. i am making a mission which has a large onslaught of zombies..It is multiplayer.. But here is the problem.. i do not know how to make the dead zombies dissapear.. now they are spawned, so i can't just go into their init and add an eventhandler or anything. I am not sure how to add it to units spawned.. does anyone have any suggestions? Basically

erase dead units multiplayer, maybe check for new guys added in every minute??

Share this post


Link to post
Share on other sites

So youve got the units spawning?

Using createunit i guess

http://community.bistudio.com/wiki/createUnit

"soldierWB" createUnit [getMarkerPos "marker_1", groupAlpha,"loon1 = this ;

this addweapon {binocular}", 0.6, "corporal"]

why not modify the above so that where the example uses "loon1 = this; this addweapon {binocular}" treat that area as your "init" so you can add the eventhandler/script to the unit there

so say

"zombieclassname" createUnit [getMarkerPos "marker_zombie", groupAlpha,"this addEventHandler ["killed",{_this exec "zombieKilled.sqs"}]", 0.8, "corporal"]

not tested in editor but should work

[pos (Position), group (Group),init (String), skill (Number), rank (String)]

Share this post


Link to post
Share on other sites

thanks for your help.. but.... okay here is the EXACT spawn line in startspawn.sqs

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

"civillian2_inf" createunit [getpos start1,zgroupja, "this addeventhandler ["killed", {_this exec "hidedeadbody.sqs"}], 0.8, "corproal"]

it's one continuous line though.. no line breaks.

It is right now giving me an error that says missing [

!!!!??!?

i've been messing around with it.. tried changing some stuff.. but i STILL can not get it.. any help?

Share this post


Link to post
Share on other sites

the problem is not the script.. but creating the units with event handlers.. i get errors.

"zombieclassname" createUnit [getMarkerPos "marker_zombie", groupAlpha,"this addEventHandler ["killed",{_this exec "zombieKilled.sqs"}]", 0.8, "corporal"]

yeah this gives me a parenthesis error...

=[[[

Share this post


Link to post
Share on other sites
the problem is not the script.. but creating the units with event handlers.. i get errors.

"zombieclassname" createUnit [getMarkerPos "marker_zombie", groupAlpha,"this addEventHandler ["killed",{_this exec "zombieKilled.sqs"}]", 0.8, "corporal"]

yeah this gives me a parenthesis error...

=[[[

You have a strings embedded inside a string. Try this one:

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

"zombieclassname" createUnit [getMarkerPos "marker_zombie",groupAlpha,"this addEventHandler [""killed"",{_this exec ""zombieKilled.sqs""}]", 0.8, "corporal"]

Share this post


Link to post
Share on other sites
"zombieclassname" createUnit [getMarkerPos "marker_zombie", groupAlpha,"this addEventHandler ["killed",{_this exec "zombieKilled.sqs"}]", 0.8, "corporal"]

You have " inside a string (the init field). So, you have to use double quote.

"zombieclassname" createUnit [getMarkerPos "marker_zombie", groupAlpha,"this addEventHandler [""killed"",{_this exec ""zombieKilled.sqs""}]", 0.8, "corporal"]

Please note that the eventhandler will only work on the machine that is running this creation script, so dont plan on doing anything major with the event.

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  

×