Aller au contenu

Photo

Scripting creatures spawning in


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

#1
Caldarin V

Caldarin V
  • Members
  • 269 messages
I'm trying to have a bunch of darkspawn show up after a cutscene plays, but the area is used before hand and I don't want them to be there. What's the script to make them pop up? I assume I can put it in the same trigger that executes the cutscene right?

#2
ladydesire

ladydesire
  • Members
  • 1 928 messages
Is it an existing game area, or one that you've made? If the latter, you can place them in the area, mark them as inactive, and have the cutscene ending script set them as active.

#3
Caldarin V

Caldarin V
  • Members
  • 269 messages
thanks! I guess the next question is where can I find the script needed to make the switch? My capabilities are laughably limited :(

#4
techwench

techwench
  • Members
  • 79 messages
You would just have to place something like this in your cutscene end script:

#include "utility_h"
#include "wrappers_h"

void main() {
    	oHero = GetHero();
	
    	// define creature objects
    	object oCreatureName = UT_GetNearestCreatureByTag(oHero, "tag_of_creature");
	
    	// set creature active
    	WR_SetObjectActive(oCreatureName, TRUE);
}

Granted, that is extremely basic...

Modifié par techwench, 10 janvier 2011 - 03:26 .


#5
Proleric

Proleric
  • Members
  • 2 350 messages
UT_TeamAppears works fine, too.

Or just set the TRIGGER_ENCOUNTER_TEAM variable on the trigger.

#6
Caldarin V

Caldarin V
  • Members
  • 269 messages
hey guys- I tried both suggestions and neither of them work, granted I might be missing something.

Proerlic- I have the Genlock set to team 1, and the TRIGGER_ENCOUNTER_TEAM also set to 1.



Tech- I put that exact script into my cutscene's end script, but nothing happens. I put the tag of the creature into where you had "tag of creature" written.



obviously I Tried one, then the other- anything else I might be missing?

thanks for your help though!

#7
Proleric

Proleric
  • Members
  • 2 350 messages
TRIGGER_ENCOUNTER_TEAM certainly works, provided your trigger script passes the event to trigger_core.

There could be an export issue. If you change the trigger variable first, then change the team number on the creature template, you have to export the area again (see wiki).

Modifié par Proleric1, 12 janvier 2011 - 07:41 .


#8
Caldarin V

Caldarin V
  • Members
  • 269 messages
what should the script look like if I want to use trigger_encounter_team?

#9
Proleric

Proleric
  • Members
  • 2 350 messages
You could just use trigger_core, or, if you need to do other stuff, something like this:

[dascript]
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"

void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int bEventHandled = FALSE;
object oTrigger = OBJECT_SELF;
string sTrigger = GetTag(oTrigger);
object oCreature = GetEventCreator(ev);
object oPC = GetHero();

switch(nEventType)
{
case EVENT_TYPE_ENTER:
{
/* do stuff */
break;
}
}

if (!bEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_TRIGGER_CORE);
}
}
[/dascript]



#10
Caldarin V

Caldarin V
  • Members
  • 269 messages
Finally got it working! Thank you so much, both you you, for being so patient with my ignorance of scripting!!!