Jump to content

Home

Behavior state problem/question


Vegar01

Recommended Posts

I'm constructing a very simple map, with a very simple mission (it's a test-map). I'v have a square room with a square platform in the center, put two NPCs in it, made two navgoals, four waypoints. I'v got the NPCs to walk around the platform in the middle with some basic scripting, but now want them to react when every i hit/shot them. I'v tried SET_PAINSCRIPT, but I could'n seem to get it to work. The two NPCs are: "eLuke1" and "eReborn1.

 

My spawnscript for both NPCs: (there are some changes, with navgoals and NPC_targetname, but their almost alike)

rem ( "lukewalk" );

set ( "SET_BEHAVIOR_STATE", "BS_CINEMATIC" );

set ( "SET_IGNOREENEMIES", "true" );

task ( "walk1" )

{

set ( "SET_WALKING", "true" );

set ( "SET_NAVGOAL", "nav2" );

}

dowait ( "walk1" );

task ( "walk2" )

{

set ( "SET_WALKING", "true" );

set ( "SET_NAVGOAL", "nav1" );

}

dowait ( "walk2" );

loop ( -1 )

{

dowait ( "walk1" );

dowait ( "walk2" );

}

set ( "SET_PAINSCRIPT", "duel/klikk" );

 

And this works fine, except the fact that PAINSCRIPT never gets launched, even if i shot them multiple times.

 

My PAINSCRIPT (duel/klikk):

flush ( );

 

affect ( "kyle", FLUSH )

{

set ( "SET_WEAPON", "WP_ROCKET_LAUNCHER" );

}

 

affect ( "eLuke1", FLUSH )

{

set ( "SET_BEHAVIOR_STATE", "BS_DEFAULT" );

set ( "SET_IGNOREENEMIES", "false" );

set ( "SET_ENEMY_TEAM", "TEAM_PLAYER" );

set ( "SET_LOCKED_ENEMY", "true" );

set ( "SET_ENEMY", "kyle" );

set ( "SET_PAINSCRIPT", "NULL" );

}

 

affect ( "eReborn1", FLUSH )

{

set ( "SET_BEHAVIOR_STATE", "BS_DEFAULT" );

set ( "SET_IGNOREENEMIES", "false" );

set ( "SET_ENEMY_TEAM", "TEAM_PLAYER" );

set ( "SET_LOCKED_ENEMY", "true" );

set ( "SET_ENEMY", "kyle" );

set ( "SET_PAINSCRIPT", "NULL" );

}

 

Even though the scripts never runs with PAINSCRIPT I'v tried to run it trough SPAWNSCRIPT and DEATHSCRIPT, and then it works like it should (except that the NPC of some reason only walks, never runs). I made the spawn- and deathscripts in the entity-window in Radiant, but I don't know if that has anything to say.

 

Any one knows why my Painscript doesn't work? Please.

 

And one more thing:

If i get the painscript to work, do the Flush erase all of the code in my original script? Meaning that my NPC will stop walking around the circle? If not, how do I do that?

Link to comment
Share on other sites

What I'm sure about is that a command will never execute if it is AFTER a never ending loop. So put that SET_PAINSCRIPT command BEFORE the loop.

 

And I think the SET_WALKING commands are redundant, strip them from the tasks and put a single one before them. I can be wrong about this.

 

The following is from the ICARUS Manual: "Flushes are useful for clearing previous scripts that are running in loops. A flush will delete that loop."

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...