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


Thread Rating:
  • 4 Vote(s) - 3.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripting n00b in need of help.
Chilton Offline
Member

Posts: 138
Threads: 9
Joined: Sep 2010
Reputation: 0
#11
RE: Scripting n00b in need of help.

(11-13-2010, 03:30 PM)Akumasama Wrote: So the function that you create with one of the functions in the list, has a standard syntax?
(string &in asParent, string &in asChild, int alState)

If so, then I think I'm beginning to understand how this scripting works alot better.

Also, you don't particularly need the onEnter, onStart and onLeave.
You only put those in when you want something to happen at start, enter area or leave area.
Close - You need OnEnter, OnStart and OnLeave for the map to load up in the first place :p
Or OnEnter at least, as its the default initialiser.
Im just going to actually write a hypothetical script using the previously mentioned basis to ensure we're on the same page

void OnStart()
{
AddEntityCollideCallback("Player", "Origin", "scareactivate", true, 1);
}

void scareactivate(string &in asParent, string &in asChild, int alState)
{
void ChangeMap("Map2", "Player_Start_Area_1", "", "");
}

Thats purely an example, and wouldnt work unless you had a map named Map2, and a spawn called Player_Start_Area_1

Best of luck, feel free to post or PM any further questions
11-13-2010, 03:41 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#12
RE: Scripting n00b in need of help.

Thanks Chilton, Cellrage and Gamekingdude.

I'll post on this topic again should I have another problem.
11-13-2010, 03:53 PM
Find
anzki Offline
Member

Posts: 88
Threads: 6
Joined: Apr 2010
Reputation: 1
#13
RE: Scripting n00b in need of help.

And also you don't need to have OnStart, OnEnter and OnLeave!

[Image: 2qnr5av.png]
(This post was last modified: 11-18-2010, 03:21 PM by anzki.)
11-13-2010, 05:42 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#14
RE: Scripting n00b in need of help.

You don't even need a .hps to load a map.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
11-13-2010, 05:54 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#15
RE: Scripting n00b in need of help.

Yep, you don't need a .hps file to load a file.
I ran my map quite a few times without the hps.

The only thing you need, is a config file at the root of your story, and a map.
Okay, sorry for double post, but I thought it wouldn't get "bumped" to the top again and get unseen messages Tongue

I can't find a proper Script Function to give a door a small push so it opens a bit.

void OnStart()
{  
   GiveItemFromFile("lantern", "lantern.ent");

   for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");

AddEntityCollideCallback("Player", "scaretrigger", "scareactivate", true, 1);
SetEntityCallbackFunc("lantern", "lanterndooractivate");
}

void scareactivate(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("scaremonster", true);
AddEnemyPatrolNode("scaremonster", "scaremonsterpath1", 0, "");
}

void lanterndooractivate(string &in entity, string &in type)
{
SetSwingDoorLocked("doorlantern", false, false);
HERE MUST GO THE CODE FOR THE PUSH!
}

I've tested if the trigger worked, and the door did unlock.
So it only has to get a little push now.

I tried "RotatePropToSpeed", but it makes the door ummm... well float and unable to be used.
(This post was last modified: 11-13-2010, 08:38 PM by Akumasama.)
11-13-2010, 07:37 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#16
RE: Scripting n00b in need of help.

I'd go with AddPropForce here, and use SetSwingDoorDisableAutoclose so it doesn't 'stick' to being close.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
11-13-2010, 08:50 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#17
RE: Scripting n00b in need of help.

I've seen that one too, but I'm not sure what I would do with asCoordSystem?
11-13-2010, 09:54 PM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#18
RE: Scripting n00b in need of help.

Use either "World" or just "", it's not really important.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
11-13-2010, 10:05 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#19
RE: Scripting n00b in need of help.

(11-13-2010, 10:05 PM)Frontcannon Wrote: Use either "World" or just "", it's not really important.

Okay thanks!
11-13-2010, 11:14 PM
Find
Akumasama Offline
Member

Posts: 122
Threads: 2
Joined: Nov 2010
Reputation: 0
#20
RE: Scripting n00b in need of help.

Well that didn't quite work...

SetSwingDoorLocked("doorlantern", false, false);
AddPropForce("doorlantern", 1, 1, 1, "");
Thats what I have at the moment...
I have also tried "World" instead of "".
Also tried different values at the coordinates.

I have also tried SetSwingDoorClosed("doorlantern", false, false).
It didn't work.
This is used by the Frictional Games, as far as I've seen.

void OnStart()
{  
AddEntityCollideCallback("Player", "scaretrigger", "scareactivate", true, 1);
SetEntityCallbackFunc("lantern", "lanterndooractivate");
SetSwingDoorDisableAutoClose("doorlantern", true);
}

void scareactivate(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("scaremonster", true);
AddEnemyPatrolNode("scaremonster", "scaremonsterpath1", 0, "");
}

void lanterndooractivate(string &in entity, string &in type)
{
SetSwingDoorLocked("doorlantern", false, false);
AddPropForce("doorlantern", 1, 1, 1, "World");
}

Just posting this too if it helps.

EDIT: I noticed that the door only unlocks, but still auto-closes...
That's kinda vague if you ask me.
Does anyone know what could be it? :/
(This post was last modified: 11-14-2010, 02:16 AM by Akumasama.)
11-14-2010, 02:08 AM
Find




Users browsing this thread: 1 Guest(s)