Is there a better way to do this?

Post » Tue Jan 11, 2011 6:47 am

I'm trying to set up a bunch of spawn points that will spawn based on a random value. Everything works fine but the scripting is turning out to be a bit clumsy. This is the basic script entry I'm using:

Begin OnTriggerEnter Player	set RandomChance to GetRandomPercent		if RandomChance <50			MutantPatrol01.enable		Else			MarkForDelete		endifEnd


The problem is that with one type of spawn I want to add, I'll have 218 entries and I'm not going to have enough lines in the script to put them all in. I want each spawn to get an individual random roll and I was wondering if there were a way I could set it up to tell the game to perform that action on each individual spawn point, without using up so many script lines.
User avatar
Milagros Osorio
 
Posts: 3426
Joined: Fri Aug 25, 2006 4:33 pm

Post » Tue Jan 11, 2011 8:25 am

I'm trying to set up a bunch of spawn points that will spawn based on a random value. Everything works fine but the scripting is turning out to be a bit clumsy. This is the basic script entry I'm using:

Begin OnTriggerEnter Player	set RandomChance to GetRandomPercent		if RandomChance <50			MutantPatrol01.enable		Else			MarkForDelete		endifEnd


The problem is that with one type of spawn I want to add, I'll have 218 entries and I'm not going to have enough lines in the script to put them all in. I want each spawn to get an individual random roll and I was wondering if there were a way I could set it up to tell the game to perform that action on each individual spawn point, without using up so many script lines.


Sorry i didnt read it right,

if you use a invisable marker ontop of each spawn point and embed this script into those markers then each it will happen for each spawn point? is that what you want?
User avatar
Greg Swan
 
Posts: 3413
Joined: Tue Jun 05, 2007 12:49 am

Post » Tue Jan 11, 2011 4:09 am

Sorry i didnt read it right,

if you use a invisable marker ontop of each spawn point and embed this script into those markers then each it will happen for each spawn point? is that what you want?


Actually I've been using a trigger script attached to a single multi-bound object. In order to make that work though, I have to include the names of each reference I want to enable. I thought of having multiple triggers, but I felt that having just a single one would work the best. So that one trigger would possibly enable up to 218 NPCs in the Wasteland. Either that or delete the unused reference. I realize that I don't need to use the MarkForDelete command but I figure if those references aren't being used for anything, why keep them in the game. I'm just wondering if maybe there was a script command to tell the game to run the random chance throw on multiple references, rather than having individual entries for each one. The way I've been doing it so far does work, but it's rather clumsy.
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Tue Jan 11, 2011 8:04 am

Actually I've been using a trigger script attached to a single multi-bound object. In order to make that work though, I have to include the names of each reference I want to enable. I thought of having multiple triggers, but I felt that having just a single one would work the best. So that one trigger would possibly enable up to 218 NPCs in the Wasteland. Either that or delete the unused reference. I realize that I don't need to use the MarkForDelete command but I figure if those references aren't being used for anything, why keep them in the game. I'm just wondering if maybe there was a script command to tell the game to run the random chance throw on multiple references, rather than having individual entries for each one. The way I've been doing it so far does work, but it's rather clumsy.




Ive just been trying to write a script but i cant seem to find the right functions this doesnt work but in theory i think it would


Short NNNRef SpawnBegin ontriggerenter         Repeat == 218         Getrandompecent                If randomchance <50                        Set getrandomvalue 1 - 218                        Get randomvalue                        NNN == randomvalue                        Spawn Mutantpatrol01                        moveto Spawn                endifEnd


But now back to the real world and working with what we have got i cant see any other way short of acutally listing every spawn in the script but seeing as im just learning script my self i will see what i can do =]
User avatar
Julie Ann
 
Posts: 3383
Joined: Thu Aug 23, 2007 5:17 am

Post » Tue Jan 11, 2011 9:12 am

Assuming I've understood what you want to do correctly, you could set up each spawn point as, say, a trigger box with an attached script - something like this:
ref myrefBegin OnLoad   set myref to GetSelfEndBegin Gamemode    if quest.trigger == 1    if getrandompercent > 50      myref.placeatme mutanttype1 1      etc...


Alternatively, if you have unique patrols for each spawn point you can set them as linked refs and then do a linkedref.enable instead of the placeatme. One fairly small script should then be able to cover all 200 spawn points. (Note that the trigger box doesn't actually trigger, it's just there to provide something to attach the script to.)
User avatar
Becky Cox
 
Posts: 3389
Joined: Thu Jun 22, 2006 8:38 am

Post » Tue Jan 11, 2011 4:57 am

Assuming I've understood what you want to do correctly, you could set up each spawn point as, say, a trigger box with an attached script - something like this:
ref myrefBegin OnLoad   set myref to GetSelfEndBegin Gamemode    if quest.trigger == 1    if getrandompercent > 50      myref.placeatme mutanttype1 1      etc...


Alternatively, if you have unique patrols for each spawn point you can set them as linked refs and then do a linkedref.enable instead of the placeatme. One fairly small script should then be able to cover all 200 spawn points. (Note that the trigger box doesn't actually trigger, it's just there to provide something to attach the script to.)



but you would have to go thought and attact it to all of the 218 spawn points which seems abit annoying


my Idea was using a using a refereance with a veriable number on the end of it but the silly RNG doesnt work in Geck =[
User avatar
Nice one
 
Posts: 3473
Joined: Thu Jun 21, 2007 5:30 am

Post » Tue Jan 11, 2011 1:05 am

but you would have to go thought and attact it to all of the 218 spawn points which seems abit annoying


my Idea was using a using a refereance with a veriable number on the end of it but the silly RNG doesnt work in Geck =[


Well, you have to set up your 200 spawn points and there's no way I can think of to automate that. But the point is that the trigger box is the same in every case, so it's no more of a chore than putting 200 x-markers into the game.

You are right that there is no concept of array processing in the GECK, no pointers or modifiers, so dealing with 200 of anything is going to be a nuisance at some level.
User avatar
Ebony Lawson
 
Posts: 3504
Joined: Fri Feb 16, 2007 11:00 am

Post » Tue Jan 11, 2011 11:37 am

Well, you have to set up your 200 spawn points and there's no way I can think of to automate that. But the point is that the trigger box is the same in every case, so it's no more of a chore than putting 200 x-markers into the game.

You are right that there is no concept of array processing in the GECK, no pointers or modifiers, so dealing with 200 of anything is going to be a nuisance at some level.




*shakes fist at bethesda*
User avatar
Solène We
 
Posts: 3470
Joined: Tue Mar 27, 2007 7:04 am

Post » Tue Jan 11, 2011 9:00 am

Assuming I've understood what you want to do correctly, you could set up each spawn point as, say, a trigger box with an attached script - something like this:
ref myrefBegin OnLoad   set myref to GetSelfEndBegin Gamemode    if quest.trigger == 1    if getrandompercent > 50      myref.placeatme mutanttype1 1      etc...


Alternatively, if you have unique patrols for each spawn point you can set them as linked refs and then do a linkedref.enable instead of the placeatme. One fairly small script should then be able to cover all 200 spawn points. (Note that the trigger box doesn't actually trigger, it's just there to provide something to attach the script to.)


That's not quite what I had in mind. I do have patrol routes, in fact that's the whole purpose for adding these spawns. Each NPC type has a route that will take them all over the map. But I've noticed that they will conduct their patrols in the background whether I'm in the area or not, so I don't really want to use an OnLoad blocktype. I'd like them to execute their patrols ASAP so I can never be sure where I'll run into them, much like what happens with the trade caravans. Which means I want to trigger a bunch of them all at once, rather than individually as I come across the spawn points. I've actually had a bit a problem trying to limit the number of NPCs that are active at once. At first, I'd come across a spot where there'd be this massive pitched battle involving a dozen or so NPCs, with dead bodies piled up everywhere. I've managed to narrow it down some by using the GetDistance condition. I did manage to get all the points into one script though, so I'll just use that. I had to drop the MarkForDelete command but at least it's working. I was just hoping for an easier way to script it.
User avatar
A Dardzz
 
Posts: 3370
Joined: Sat Jan 27, 2007 6:26 pm


Return to Fallout 3