Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Just a quick simple question!
RainbowDash Offline
Junior Member

Posts: 15
Threads: 3
Joined: Sep 2011
Reputation: 0
#1
Just a quick simple question!

I'm new to this whole thing ^_^ (kinda)
Is there anyway in code I could get my grunt to continue along his patrol route, even if he kills the player? I've noticed that my enemies like to disappear once I die. T.T That's no fun!
09-17-2011, 12:32 AM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#2
RE: Just a quick simple question!

You'd have to use
CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

Use string & asCallback to create a Callback that respawns the monster after death. (You can change the pathnodes and such)

09-17-2011, 12:39 AM
Find
RainbowDash Offline
Junior Member

Posts: 15
Threads: 3
Joined: Sep 2011
Reputation: 0
#3
RE: Just a quick simple question!

As I'm new to the language, how exactly would I set this up in my code?
////////////////////////////// Run first time starting mapvoid
OnStart()
{      
GiveItemFromFile("lantern", "lantern.ent");        
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");        
AddEntityCollideCallback("Player", "PlayerCollide", "GruntBegin", true, 1);
}
////////////////////////////// Run when entering mapvoid
OnEnter()
{
}
////////////////////////////// Run when leaving mapvoid
OnLeave()
{
}

void GruntBegin(string &in asParent, string &in asChild, int alState)
{    
SetEntityActive("servant_grunt_1", true);     
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");    
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");    
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 4, "2");    
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");    
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3, "2");
}

This is just what I threw together from reading some tuts, I understand the commands and what not...

I'm going to have to assume, in this engine, the level script file is constantly looping? I'm actually used to actionscript, nothing to flashy, so I'm not exactly at home when it comes to C variants... (I'm taking them up shortly though, this could give me a head start ^_^)
How exactly would I go about checking if the player died, going about respawning the monster, and all that jazz. o.o?
I hate asking for people to DO my code for me, but I guess to start I need things to thoroughly examine and study before creating my own ^_^
(This post was last modified: 09-17-2011, 12:46 AM by RainbowDash.)
09-17-2011, 12:45 AM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#4
RE: Just a quick simple question!

So to try and put this simple...

CheckPoint (string& asName, string& asStartPos, string& asCallback, string& asDeathHintCat, string& asDeathHintEntry);

When you put this inside the void OnStart()
The next time the player dies, that function is ran.
So to make things happen after the player dies you can use the asCallback.
example script:

void OnStart() //I just changed things to happen right when the map is ran
{CheckPoint ("", "NameOfSomeStartPos", "RespawnMonster", "", "");
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 4, "2");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3, "2");

}
void RespawnMonster(string &in asName, int alCount)
{SetEntityActive("servant_grunt_1", true); //when player dies, the monster is spawned again
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 1, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 4, "2");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 3, "2");

}

You can do all neat stuff with the checkpoints, like making the player wake up on an unknown place or change the path of the grunt.
(hope you like my color coding!)

09-17-2011, 09:25 AM
Find
RainbowDash Offline
Junior Member

Posts: 15
Threads: 3
Joined: Sep 2011
Reputation: 0
#5
RE: Just a quick simple question!

Thank you so much! This is exactly what I needed, just a quick little in depth guide through the command ^_^ -bro fist- They should give little desc's like this for all commands in the script page... maybe a nice collaboration of people ^_^ Anywho, now I can get started on making a less pointless first attempt at a level Big Grin Merci!
09-17-2011, 03:20 PM
Find
RainbowDash Offline
Junior Member

Posts: 15
Threads: 3
Joined: Sep 2011
Reputation: 0
#6
RE: Just a quick simple question!

Dang ok uhm... how about if I want the monster to remain spawned, regardless of how far the player is? Through the patrol route I set for him, he despawns T.T


... nevermind I got it. LOL.
(This post was last modified: 09-17-2011, 04:54 PM by RainbowDash.)
09-17-2011, 04:51 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#7
RE: Just a quick simple question!

(09-17-2011, 04:51 PM)RainbowDash Wrote: Dang ok uhm... how about if I want the monster to remain spawned, regardless of how far the player is? Through the patrol route I set for him, he despawns T.T
You mean monsters disappear if the player is too far away from them? I am not even aware of such thing (I have hardly used grunts/brutes). That sounds like it has something to do with the engine or it might be changed from the files you can modify when doing a full conversion. I'm not sure tbh...

(09-17-2011, 04:51 PM)RainbowDash Wrote: ... nevermind I got it. LOL.
Edit. mmh okay!?

(This post was last modified: 09-17-2011, 04:58 PM by Khyrpa.)
09-17-2011, 04:57 PM
Find
RainbowDash Offline
Junior Member

Posts: 15
Threads: 3
Joined: Sep 2011
Reputation: 0
#8
RE: Just a quick simple question!

(09-17-2011, 04:57 PM)Khyrpa Wrote: You mean monsters disappear if the player is too far away from them? I am not even aware of such thing (I have hardly used grunts/brutes). That sounds like it has something to do with the engine or it might be changed from the files you can modify when doing a full conversion. I'm not sure tbh...
Well, I had him fallow 4 path nodes, in coded order as 1,2,3,4. By making it 1,2,3,4,1 , loops his patrol rather then despawn at 4. Now I have a problem where the monster will despawn after he sees the player, and the player makes a successful escape. Hmm... I need to make him revert back to patrolling upon not seeing the player...
09-17-2011, 05:24 PM
Find




Users browsing this thread: 4 Guest(s)