Turning off $enemyspawnertriggers

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Smithy
Corporal
Posts: 46
Joined: Fri Aug 18, 2006 8:54 pm
Location: United Kingdom

Turning off $enemyspawnertriggers

Post by Smithy »

Well I have two enemyspawnertriggers that I want to be made triggerable (after being made nottrigerable), I know the process mostly, it's just that all spawner triggers have a targetname of $enemyspawnertrigger, so how would I be able to make specific ones nottriggerable in a script?

I can't use triggerable $enemyspawnertrigger / nottriggerable $enemyspawnertrigger because it would affect all of them.
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

Look at the global/ai.scr
You can set off spawners multiple times, but each trigger only can set them off once.
That is from the ai.scr
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

The triggers have different set numbers you can use that too by going thought all of them and only turn off ones of a certain set number .
Image
Smithy
Corporal
Posts: 46
Joined: Fri Aug 18, 2006 8:54 pm
Location: United Kingdom

Post by Smithy »

bdbodger wrote:The triggers have different set numbers you can use that too by going thought all of them and only turn off ones of a certain set number .

Oh the #sets, how would I go about doing that?
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

I think you would give one of your triggers the key/value of #set/1 and so on until you have a set number for all of your triggers and in the script you would have "#1 triggerable" to turn on #1. I am not sure but you could try this.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

exploder script

Post by tltrude »

This is how the exploder script does it. "Local.num" becomes the set number, so the thread would be run with lines like these.

thread turnON 2
thread turnON 3

Code: Select all

turnON local.num:

	for (local.i=1;local.i<$enemyspawnertrigger.size+1;local.i++)
	{
		if (local.num == $enemyspawnertrigger[local.i].set) // if trigger #set and local.num are the same
		{
			$enemyspawnertrigger[local.i] triggerable
		}
	}

end
I'm not sure this is right, and there is probably an easier way to script it.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Thats the right way . Another way is to control the spawning your self like this that I did for one of my maps .

Create the spawners

Code: Select all

level.snowguy = exec global/makearray.scr $snowguy

	for (local.i=1;local.i <= level.snowguy.size;local.i++)
	level.snowguy[local.i] = waitthread global/spawner.scr::spawner_create level.snowguy[local.i]

Spawn an ai from the spawner you created

Code: Select all

level.snowdude[local.i] = waitthread global/spawner.scr::spawner_activate level.snowguy[local.i]
That will spawn a spawner . It can be done in a loop or by just setting the number you want to spawn

Code: Select all

level.snowdude = waitthread global/spawner.scr::spawner_activate level.snowguy[3]
What the waitthread global/spawner.scr::spawner_create thread does is to turn the guy into a spawner by saving all his settings and creating a script origin in his place . The waitthread global/spawner.scr::spawner_activate thread then spawns him . Not only are the settings saved but even after you spawn him the script origin is still there so you can activate it again and again if needed . What I used it for was to spawn a guy then when he died I spawned him again . If you had 5 guys like that then when one died another would be spawned in his place so there was always 5 guys . Next what I did was when I made the ai I set his type_idle to runner . I made a path with pathnodes and I set his patrol path to one of the nodes so when he spawned he ran his path . You can use this by first creating the spawer , second activate him when needed , third have him be a runner so that he runs a certain route . If the path loops so that the last node targets the first node then he keeps running the path like one of the ai's that patrol . If the path ends then he just stops at the end of the path .
Image
Smithy
Corporal
Posts: 46
Joined: Fri Aug 18, 2006 8:54 pm
Location: United Kingdom

Post by Smithy »

Thankyou guys, I will test these out.
Post Reply