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
Scripting help :)
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#1
Scripting help :)

Hi! I'm not that good at scripting, it's kind of blunt and ineffective when I do it. I have placed different areas at which pathnodes to a monster is added. The path is either decided randomly, or if the monster previously has searched an area it shouldn't return again.


I just tried it out but he disappeared once he reached pathchoice 1. I'm unsure of how to set up the "if clauses" :/ ... So two things:
1. Why do you think he disappeared? I was close (so shouldn't be distance) - was no pathnodes added? Stuck at something?
2. What I really want: If "changedir" = 1 do that option. Otherwise check the value of "checkedcloak"; if = 0 roll for random search - otherwise continue.

I probably should make my scripting more effective Smile
Spoiler below!


//Activation

void DefaultEvent5(string &in asParent, string &in asChild, int alState)
{

SetEntityActive("cloakedman_2", true);
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_6", RandFloat(1.4,4.5), "Idle");
AddEntityCollideCallback("cloakedman_2", "ScriptArea_Enemy_Patrol_1", "PathChoice1", false, 1);
AddEntityCollideCallback("cloakedman_2", "ScriptArea_Enemy_Patrol_2", "PathChoice2", false, 1);
AddEntityCollideCallback("cloakedman_2", "ScriptArea_Enemy_Patrol_3", "PathChoice3", false, 1);
}

//Pathchoice number 1
void PathChoice1(string &in asParent, string &in asChild, int alState)
{
if (GetLocalVarInt("CheckedCloth") == 0 && RandInt(0,1)==1)
{
SetLocalVarInt("CheckedCloth", 1);
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_15", RandFloat(1.4,2.5), "Idle");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_6", RandFloat(1.4,1.9), "Idle");
}
else if (GetLocalVarInt("ChangeDir") == 1)
{
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_2", RandFloat(1.4,3.1), "");
}
else
SetLocalVarInt("CheckedCloth", 0);
AddEnemyPatrolNode("cloakedman_7", "PathNodeArea_12", 0.0f, "");
AddEnemyPatrolNode("cloakedman_8", "PathNodeArea_13", 0.0f, "");
AddEnemyPatrolNode("cloakedman_7", "PathNodeArea_14", 0.0f, "");
AddEnemyPatrolNode("cloakedman_9", "PathNodeArea_14", RandFloat(1.4,3.1), "");
}

//Pathchoice number 2

void PathChoice2(string &in asParent, string &in asChild, int alState)
{
if (GetLocalVarInt("CheckedStair") == 0 && RandInt(0,1)==1)
{
SetLocalVarInt("CheckedStair", 1);
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_10", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_16", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_17", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_18", RandFloat(1.4,3.5), "Idle");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_17", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_16", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_11", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_10", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_9", RandFloat(1.4,1.9), "Idle");
}
else if (GetLocalVarInt("ChangeDir") == 1)
{
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_7", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_6", 0.0f, "");
}
else
SetLocalVarInt("CheckedStair", 0);
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_14", RandFloat(1.4,3.1), "");
}


//Pathchoice number 3

void PathChoice3(string &in asParent, string &in asChild, int alState)
{
if (RandInt(0,1)==1)
{
SetLocalVarInt("ChangeDir", 0);
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_3", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_4", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_5", 0.0f, "");
AddEnemyPatrolNode("cloakedman_2", "PathNodeArea_6", RandFloat(1.4,4.5), "Idle");
}
else
SetLocalVarInt("ChangeDir", 1);
AddEnemyPatrolNode("cloakedman_9", "PathNodeArea_14", RandFloat(1.4,3.1), "");
}


[Image: mZiYnxe.png]


10-01-2011, 02:49 PM
Find
DarkSnowman Offline
Junior Member

Posts: 13
Threads: 3
Joined: Sep 2011
Reputation: 0
#2
RE: Scripting help :)

may have something to do with the path nodes....
(This post was last modified: 10-01-2011, 03:04 PM by DarkSnowman.)
10-01-2011, 02:56 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#3
RE: Scripting help :)

Changed some things around; I might have solved it.

[Image: mZiYnxe.png]


10-01-2011, 03:19 PM
Find
UnseenLegend ( NL ) Offline
Member

Posts: 171
Threads: 10
Joined: Sep 2011
Reputation: 12
#4
RE: Scripting help :)

(10-01-2011, 03:19 PM)Acies Wrote: Changed some things around; I might have solved it.
maybe you but a timer into it

[Image: read-image.asp?n=n-20121202110321-m.jpg&r=8]
10-02-2011, 01:39 PM
Find




Users browsing this thread: 1 Guest(s)