Unit Spawn Trouble

  • Thread starter Thread starter Gidgert
  • Start date Start date
G

Gidgert

Guest
I am trying to make a trigger, that every .1 second will create a random number between 1 and 4, whatever number is chosen will show where the unit spawns, 1 as top, 2 as bottom, 3 as left, 4 as right. i basicly confused myself w/ this one i could really use some help.
 
You can create an array of the regions:
Code:
SpawnRegions[1]=Region1
SpawnRegions[2]=Region2
SpawnRegions[3]=Region3
SpawnRegions[4]=Region4
And then you do:
Code:
Unit - Create 1 Footman for Player 1 Red at (Center of [B]SpawnRegions[(Random integer between 1 and 4)][/B] facing (Default Building Facing)
 
Well i have already created the regions where i would like the units to spawn, but i still dont get how i can make a trigger to create that random number, much less have another trigger realise what that random number is :-/

This is what i ended up doing, and i got an error.

//===========================================================================
// Trigger: Murloc Spawn
//===========================================================================
function Trig_Murloc_Spawn_Actions takes nothing returns nothing
SpawnRegions[1]=Left Spawn
SpawnRegions[2]=Right Spawn
SpawnRegions[3]=Top Spawn
SpawnRegions[4]=Bottom Spawn
Unit - Create 1 Murloc for Player 5 yellow at (Random point in spawnregions[(Random integer between 1 and 4)] facing (Default Building Facing)
endfunction
 
You don't need to type the script, just make it with the GUI.

Make sure you create the variable SpawnRegions as a region array.

Make a regular action to create the units, but for the region select the SpawnRegions variable. Then for the index, go to Math - Random Number.

Here's what the finished action should look like:
 

Attachments

  • Dialog.JPG
    Dialog.JPG
    30.3 KB · Views: 119
It works, but how do i tie this trigger to the 4 actual spawn points around the map, currently they all just spawn in the center wich i dont want them to.
 
You set the variable to the regions at the spawn points.

Create your regions if you haven't already and make a trigger to run at Map Initialization in which you set the SpawnRegions variable to the different regions.
 
Ok now i have stumbled onto another problem, I want these units that i am spawning, to insta-kill a certain unit if it touches it. Could you point me to how i would go about doing this. would it be VIA trigger, ability or some combination?
 
Unit - Within Range of Unit (unit MUST already be on map)

Unit - Kill Unit
 
What do you mean by "certain unit"?
If you mean a single unit type, it would probably be easier to do it with triggers:

Make a trigger to do the insta-kill.
Don't put any events.
Make the condition (Unit type of (Triggering Unit)) Equal to Whatever unit type
Make the action to kill the Triggering Unit.

In your spawning trigger, add the Trigger - Add Event action. Make the event "Unit - A Unit comes within 50.00 of (Last Created Unit)".
That should make it so when a unit comes within 50.00 of the spawned unit, if it is the right type, will be killed instantly.
 
hmph, having trouble w/ the unit within range, do i need to make a custom variable for it?
 
Alright, finally got it "working correctly" but instead of insta killing the unit i want to whenever it gets w/in 50 of any other unit it spawns another... within a few seconds the game crashed because of so many spawning mobs at once >.< . anyone have a solution?
 
You gotta use the ACTION add event to trigger, and add the unit comes in range event to the insta-kill trigger, not to the spawn trigger.
 
E:
C: (Unit-type of (Triggering unit)) Equal to Castaway
A: Trigger - Add to (This trigger) the event (Unit - A unit comes withing 50.00 of???????????????
Unit - Kill Triggering Unit
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Happy Thursday!
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    we were down for a minute - think a log file or something got too big
    +1
  • Ghan Ghan:
    The alerts say it was down for a while unfortunately.
  • Ghan Ghan:
    Didn't know what was going on while I was at work.
  • Ghan Ghan:
    Disk filled up with logs. Fixed now.
    +1
  • The Helper The Helper:
    not a problem at all thanks for getting us back up
  • The Helper The Helper:
    I think the bots are finding a way to get through the anubis
  • The Helper The Helper:
    Happy Wednesday Everyone! Hope everyone has a Fantastic Day!
    +1
  • The Helper The Helper:
    Yeah, stats are showing big bot influx like 12k page views.
  • Wizard Wizard:
    :wave:
    +1
  • Ghan Ghan:
    TH changed his avatar again. 6 more weeks of summer.
    +3
  • Wizard Wizard:
    lol
    +1
  • The Helper The Helper:
    Guys just a heads up I am going to be shutting the site down soon. I am just waiting on the NUON people to decide whether they want to transfer forum data and keep the discord. My email is [email protected] for anyone that wants to keep in touch and I have a facebook too. I will make an official post later. Love you guys and will miss everyone!
    +1
  • V-SNES V-SNES:
    Sent a pm @The Helper
  • Stephen Stephen:
    Oh no - please don't lose the Nuon content
    +1
  • The Helper The Helper:
    Someone email AtariAge and see if they want me to transfer the forum data over to it
  • Ghan Ghan:
    Could probably keep NUON stuff around here if we wanted.
  • Ghan Ghan:
    Hmm what to do about the World Editor site though?
  • Stephen Stephen:
    I'd rather personally just own a backup of the Nuon data than see it go to AtariAge honestly. If it gets enshittified as per usual, or if some of the "regular" Jaguar folks get there, it's not gonna be fun
  • The Helper The Helper:
    There will be a github of the forum data so the NUON Forum Data I guess would be available there
  • The Helper The Helper:
    World Editor is technically Ryoko stuff not mine you guys can keep that I am not in that even
  • jonas jonas:
    :( end of an era :(
  • The Helper The Helper:
    Dont think of it as an end jonas - think of it as a beginning, because really my friend that is what it is.

The Helper Discord

Members online

No members online now.

Affiliates

Hive Workshop NUON Dome World Editor Tutorials
Back
Top