Scripting wandering creeps -1 reply

Please wait...

John117

Ghost in the shadow

50 XP

7th September 2004

0 Uploads

44 Posts

0 Threads

#1 13 years ago

How do you make a random creep wander by itself to random point on a map. the idea is to make the players be more defensive incase some level 10 creep shows up and wipes out their entire base. I've started it out with Trigger 1 Event: Map Init, Conditions: none Actions: Create 1 random -1 creep for Neutral Hostile at random point on playable map. Set variable.Wanderer.unit to lastcreatedunit Add lastcreatedunit to variable.wanderers.unitgroup Order wanderer to patrol to random point on playable map Turn trigger 2 on turn trigger 1 off Trigger 2 Event: periodic event: 60 seconds Conditions:Number in unitgroup "wanderers" = 0 Actions: Create 1 random -1 creep for Neutral hostile at random point on playable map. Set variable.Wanderer.unit to lastcreatedunit Add lastcreatedunit to variable.wanderers.unitgroup Order "wanderer" to patrol to random point on playable map my coding is rather noobish I know, but keep in mind, I'm making it up as I go so what am I doing wrong, cause when I test it, it doesn't even create that unit in the first place? I've attempted to make these triggers so that they work on all maps, regardless of size, but I'm stuck If someone could post a link to a helpful faq for something like this or post some good tips, that would be great.




John117

Ghost in the shadow

50 XP

7th September 2004

0 Uploads

44 Posts

0 Threads

#2 13 years ago

bump ouch I thought more people had this problem




Eleandor

No User title

50 XP

27th July 2004

0 Uploads

548 Posts

0 Threads

#3 13 years ago

if it's map init, why don't you just put the unit on the map, in stead of creating it with a trigger? if you've got a good reason: you can delete the ' turn trigger 1 off', because it's map init.

if not, just do this: Order "wanderer" to patrol to random point on playable map




John117

Ghost in the shadow

50 XP

7th September 2004

0 Uploads

44 Posts

0 Threads

#4 13 years ago

tried that, cept it was short-lived I added the time-lapsed event with the life of wanderer=0 condition so that every 60 seconds, if I had killed the wanderer, it would create a new one at a random point of the map. Then the thing would reset.




novicemapmaker

just plain awesome

50 XP

28th November 2004

0 Uploads

37 Posts

0 Threads

#5 13 years ago

i dunno much but i can tell you there might be a problem with the wanderers life being = to 0. if that is a problem you need to make it like, wanderer = dead but then again :lookaround:




John117

Ghost in the shadow

50 XP

7th September 2004

0 Uploads

44 Posts

0 Threads

#6 13 years ago

hmmm so something like this might work? Trigger 1 Events: Map Initialization Periodic event:1 second Conditions: none Actions: Create 1 (Random Level(Random Integer between 1 and 8)) creep unit-type) for Neutral Hostile at (Random Point in (Playable map area)) facing (Random real number between 0.00 and 360.00) degrees Add Lastcreatedunit to unit group, wanderers Set wanderer to lastcreatedunit turn trigger1 off Trigger 2 Events: A unit dies Conditions: Unit dying = Wanderer Actions: Wait 60.0 seconds turn trigger 1 on So trigger 1 creates a monster, then turns itself off, so when the monster dies, trigger 2 turns trigger 1 back on, and the whole thing resets. So does this look like it could work?




novicemapmaker

just plain awesome

50 XP

28th November 2004

0 Uploads

37 Posts

0 Threads

#7 13 years ago

looks like it would work but i found 2 possible kinks.

1. i never use all that real number stuff, its easier to just make it face default. since ive never used weird things like that i wouldnt know if it would work or not 2. if there are trees or sumthin in ur map, the creature may appear somewhere where there is no way out. then again ive never done this but food for thought