Aller au contenu

Photo

How can I make a monster endlessly respawn?


  • Veuillez vous connecter pour répondre
15 réponses à ce sujet

#1
adoado13

adoado13
  • Members
  • 4 messages
Well the title really says it all. I remember in NWN there was an "encounter" setup that allowed you to make an infinantly respawning encounter for you to fight. I see nothing like that in the DA:O toolset. I want to make a dungeon that I can grind through repeatedly but I cannot figure out how to do this. Any help would be greatly appreciated.
Thanks.

#2
Dmuse

Dmuse
  • Members
  • 44 messages
You can likely do this with triggers to spawn the encounters. That way each time you hit the trigger the encounter is spawned.



I would suggest having a plot setup with the dungeon so you can toggle on/off each trigger. This will stop your party from walking and triggering a trigger, then backing it up and triggering it again thus spawning 2 of everything -- which could be bad! :) Have the trigger check the toggle, then spawn if the toggle is on, then toggle the plotline for that trigger off so it can't be triggered again until you go back to the first trigger of the dungeon which sets all of the toggles back to on.

#3
adoado13

adoado13
  • Members
  • 4 messages
Is there a way that you could point me in the right direction as far as which script I would need to use? I'm still pretty lost.

#4
EmeryQuinn

EmeryQuinn
  • Members
  • 35 messages
http://social.biowar...hp/CreateObject

Start here, bioware shows you some code for spawning monsters.

#5
mackeyz

mackeyz
  • Members
  • 4 messages
http://social.biowar...hp/CreateObject>>>>>>tutorial's confusing????any simple tutorial plz?????

#6
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
A short script to make a creature endlessly respawn.
You have to set a waypoint for it to spawn at I gave mine a tag of teamone, and create a plot script mine was arena with a value called DS_DEAD!

#include "events_h"
//my plot script with value of DS_DEAD to let script know if creature is dead
#include "plt_arena"
#include "wrappers_h"
#include "global_objects_h"

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int flag_value = WR_GetPlotFlag(PLT_ARENA, DS_DEAD);
//set a waypoint in area so creature has a spawn point. Its tag teamone
object oWaypoint = GetObjectByTag("teamone");
//this sets the creature to the waypoint
location lWaypoint = GetLocation(oWaypoint);

switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
//pretty straight forward
// spawns the creature everytime it is killed
if(GetEventInteger(ev,0) == 1)
{
WR_SetPlotFlag(PLT_ARENA, DS_DEAD, FALSE);
}
//calls the arena_ds.utc i.e my template creature
object oDarkSpawn = CreateObject(OBJECT_TYPE_CREATURE, R"arena_ds.utc", lWaypoint);

break;
}
}
}

In your area make it's script value call this. Create an initial creature with its team set to 1, when you kill it a new creature will spawn at your waypoint !
just copy and paste this, change my values to yours and.....
EnjoyPosted Image

Modifié par Leopard73, 05 décembre 2009 - 03:33 .


#7
giskard44

giskard44
  • Members
  • 137 messages
Thanks Leopard73.



I seem to be having to dig deep in to some relatively simply areas like lighting just to get them to work so it may be some time before i am able to get on with the scripting and questing.



In the mean time here is a link to a spot where me and a guild mate of mine started talking about this very issue. I showed him your script, he is pretty good with scripts him selve but is still learning DA script.



http://www.theengine...772

#8
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
and here is another script to spawn by trigger. its very rough and needs some work if people want to contribute then knock yourselves out. My brain is fried gonna take a couple of hours off. I hope I have provided enough info for you all.



#include "events_h"

#include "plt_yours"

#include "wrappers_h"

#include "global_objects_h"

#include "utility_h"



void main()

{

event ev = GetCurrentEvent();

int nEventType = GetEventType(ev);

object oWaypoint = GetObjectByTag("yours");

location lLoc = GetLocation(oWaypoint);



switch(nEventType)

{



case EVENT_TYPE_ENTER:

{

object oCreature = GetEventCreator(ev);



if (IsPartyMember(oCreature))

{

object oNewObject = CreateObject(OBJECT_TYPE_CREATURE, R"yours.utc", lLoc);



}

break;

}



case EVENT_TYPE_EXIT:

{

object oCreature = GetEventCreator(ev);

break;

}

}

}

#9
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
If you want multiple enemies instead of just one try this

if (IsPartyMember(oCreature))



{

int i;

for(i=0; i<3; i++)

{

object oNewObject = CreateObject(OBJECT_TYPE_CREATURE, R"yours.utc", lLoc);

}

}



A simple for loop on that statement will create, in this case four of my template type creatues i.e 0, 1, 2, 3. the counter starting at zero (in programming 0 is 1, the start)

#10
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
Anybody out there know how to reset a trigger after you use destroy command! I keep trying and cant come up with anything! HELP

#11
Craig Graff

Craig Graff
  • Members
  • 608 messages
If you destroy a trigger it is gone (though if you use the trigger to save the game the game will be saved before the trigger is destroyed, meaning that loading the save causes the trigger to return).



It is generally better to either set a local variable or use SetObjectActive(oTrigger, FALSE) and then check for the variable or if the trigger is enabled in your script before running the code.

#12
hannahb

hannahb
  • Members
  • 92 messages
Im going to hazzard a guess here and say that this:



object oNewObject = CreateObject(OBJECT_TYPE_CREATURE, R"yours.utc", lLoc);



instantiates a new block in memory. As such doing something like this:



for(i=0; i<3; i++)



{



object oNewObject = CreateObject(OBJECT_TYPE_CREATURE, R"yours.utc", lLoc);



}



could cause a noticeable slowdown (aka Lag spike) when you hit the trigger especially if the number of iterations is high. Thus tipping off the player that something was coming.



As an alternative you might consider PRECREATING the creatures and keeping them in an inaccessible area of the map and then moving them where you want on the trigger event. Just an optimization trick.

#13
Craig Graff

Craig Graff
  • Members
  • 608 messages
Just a note that it would generally be much better to have the above code as
object oNewObject;
for(i=0; i<3; i++)
{
    oNewObject = CreateObject(OBJECT_TYPE_CREATURE, R"yours.utc", lLoc);
}
Also, it is worth noting that if you are going to be creating creatures instead of activating them, it is a good idea to use the CreatePool function.

Modifié par Craig Graff, 07 décembre 2009 - 09:39 .


#14
Sunjammer

Sunjammer
  • Members
  • 925 messages
Much better if social didn't eat part of your for clause!

The [code] and [/code] tags are your friends!

Modifié par Sunjammer, 07 décembre 2009 - 09:30 .


#15
Craig Graff

Craig Graff
  • Members
  • 608 messages
Nah, we never really seem to get along.

#16
Guest_Leopard73_*

Guest_Leopard73_*
  • Guests
Thanks for the nudge in right direction. I will be using createpool the above snippet was just for a quik spawn example, and by the way even an inactive trigger is active according to the wiki so the trigger has to test itself http://social.biowar...ex.php/Trigger.

That was where I was going wrong! Your kick up my arse pushed me over the 3 day research finish line.