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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Acid Scare
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#1
Acid Scare

Hi everybody! I'm trying to figure out how to do a simple Acid Scare.
I originally wanted to make something kind of close, but at the same time, not close to the original game when you have to get the acid in the Northern Prison level.

I tried using my own stuff, like names, however nothing worked. So I copied the original games coding and now everything works fine. However, now that the player has the jar filled with acid, I want him/her to collide with a script area shortly after which will spawn a suitor nearby. Although, that little script function wont work at all. I've tried using if statements and timers, but nothing will spawn the suitor.

Here is my coding:

void OnStart()
/////ADD USE ITEM CALLBACK/////
AddUseItemCallback("bottleEcon", "glass_container_1", "acid_container_1", "UseBottle", true);

void UseBottle(string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_1"){
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

RemoveItem(asItem);
GiveItemFromFile("glass_container_filled", "glass_container_filled.ent");

SetMessage("Ch02Level15", "AcidInJar", 0);

GiveSanityBoostSmall();

CompleteQuest("15Acid", "15Acid");
}
else if(asItem == "glass_container_filled"){
SetMessage("Ch02Level15", "AcidAlreadyInJar", 0);
}
else SetMessage("Ch02Level15", "AcidWithItem", 0);
}


/////SET ENTITY CALLBACK FUNC/////
SetEntityCallbackFunc("glass_container_filled", "SuitorScare");

void SuitorScare(string &in asEntity, string &in type)
{
SetEntityActive("SpawnEnemy", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnSatan", true, 1);
}

void SpawnSatan(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy_1", true);
}


When I change the scripting on the SetEntityCallbackFunc from "glass_container_filled" to "glass_container_1" then the script box goes off before I even fill the container with acid. The script box to collide with to spawn the Suitor is called "SpawnEnemy" which is set to inactive. However, when I change the name of the container to "glass_container_1", the script goes off spawning the monster despite being inactive and with no acid.

Can anyone help me out here?
10-21-2013, 04:25 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Acid Scare

Could you explane a bit moer of this part : now that the player has the jar filled with acid, I want him/her to collide with a script area shortly after which will spawn a suitor nearby

AND this part:
When I change the scripting on the SetEntityCallbackFunc from "glass_container_filled" to "glass_container_1" then the script box goes off before I even fill the container with acid
,
WHY do you have 2 glascontainers?
10-21-2013, 01:35 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Acid Scare

(10-21-2013, 01:35 PM)DnALANGE Wrote: Could you explane a bit moer of this part : now that the player has the jar filled with acid, I want him/her to collide with a script area shortly after which will spawn a suitor nearby

AND this part:
When I change the scripting on the SetEntityCallbackFunc from "glass_container_filled" to "glass_container_1" then the script box goes off before I even fill the container with acid
,
WHY do you have 2 glascontainers?

2 containers because: 1 is empty. 1 is filled.

He uses the empty container on the area.
Another area is set active.
You do this by SetEntityActive("AREANAME", true);

Then the collide function

void COLLIDEFUNCTION(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("SUITORNAME", true);
}

You also might want to add some pathnodes. Do you know how to?

Trying is the first step to success.
10-21-2013, 08:14 PM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#4
RE: Acid Scare

SetEntityCallbackFunc("glass_container_filled", "SuitorScare");

Unless I'm completely mistaken this does not work with items in your inventory.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
10-21-2013, 09:01 PM
Find
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#5
RE: Acid Scare

(10-21-2013, 08:14 PM)FlawlessHair Wrote:
(10-21-2013, 01:35 PM)DnALANGE Wrote: Could you explane a bit moer of this part : now that the player has the jar filled with acid, I want him/her to collide with a script area shortly after which will spawn a suitor nearby

AND this part:
When I change the scripting on the SetEntityCallbackFunc from "glass_container_filled" to "glass_container_1" then the script box goes off before I even fill the container with acid
,
WHY do you have 2 glascontainers?

2 containers because: 1 is empty. 1 is filled.

He uses the empty container on the area.
Another area is set active.
You do this by SetEntityActive("AREANAME", true);

Then the collide function

void COLLIDEFUNCTION(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("SUITORNAME", true);
}

You also might want to add some pathnodes. Do you know how to?

Yes, I know how to use Pathnodes.
I've tried the stuff you said. I put in a picture for you to see the level.

Within' the picture, there is the barrel of acid. There is a small script area above the pot of acid so when you interact with the barrel, you take damage. So don't worry about the little script area above the barrel of acid.
Anyways, when I use the "glass_container_1" on the acid barrel, the current "glass_container_1" disappears and becomes the "glass_container_filled".

At this point when you actually have the container filled with acid. I want the player to turn around and walk forward, except now the script area will now be active and the monster will spawn.
However, even though I already have the script to set so that the script area will be active, nothing happens.

The script area name is "SpawnEnemy", so in my code when I have this and the Suitor name is "Enemy_1". So my code looks just like this:

void OnStart()
SetEntityCallbackFunc("glass_container_filled", "SuitorScare");

void SuitorScare(string &in asEntity, string &in type)
{
SetEntityActive("SpawnEnemy", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnSatan", true, 1);
}

void SpawnSatan(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Enemy_1", true);
}

But nothing happens at all.

But the weird thing is, is if I change the name on my SetEntityCallbackFunc from "glass_container_filled" to "glass_container_1", then the script area goes off without even getting the acid.


Attached Files
.jpg   Untitled.jpg (Size: 188.42 KB / Downloads: 150)
10-22-2013, 03:07 AM
Find
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#6
RE: Acid Scare

I think I would have put my SetEntityActive function (the one that activates the script area) in your UseBottle function. Wouldn't it be easier ?
I'm still pretty noob with the scripting, but I don't exactly see why you wouldn't use something as simple as that : ).

(This post was last modified: 10-22-2013, 03:01 PM by daortir.)
10-22-2013, 02:55 PM
Find
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#7
RE: Acid Scare

(10-22-2013, 02:55 PM)daortir Wrote: I think I would have put my SetEntityActive function (the one that activates the script area) in your UseBottle function. Wouldn't it be easier ?
I'm still pretty noob with the scripting, but I don't exactly see why you wouldn't use something as simple as that : ).

I've tried that and nothing works. Sad I don't know why. I might be typing in everything wrong or putting things in the wrong place. But the script area doesn't work.
10-23-2013, 03:57 AM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#8
RE: Acid Scare

The problem here for you is that the "glass_container_filled" does not trigger the script. You should check to be sure that there is no entity in the map with that name already, cause if it is, the glass_container_filled will instead be named "glass_container_filled_1".

To be even more sure, I suggest changing the name on the filled jar to something like "filled_acid_jar" and try to script with that, to make sure no Amnesia entities interact with the name.

Let me know if this worked when you tried it, and if it didn't I'll code the script for you and explain a few simple things in the meanwhile.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
10-23-2013, 08:11 AM
Find
T122002 Offline
Junior Member

Posts: 24
Threads: 10
Joined: Dec 2012
Reputation: 1
#9
RE: Acid Scare

(10-23-2013, 08:11 AM)Wapez Wrote: The problem here for you is that the "glass_container_filled" does not trigger the script. You should check to be sure that there is no entity in the map with that name already, cause if it is, the glass_container_filled will instead be named "glass_container_filled_1".

To be even more sure, I suggest changing the name on the filled jar to something like "filled_acid_jar" and try to script with that, to make sure no Amnesia entities interact with the name.

Let me know if this worked when you tried it, and if it didn't I'll code the script for you and explain a few simple things in the meanwhile.

I just tried exactly what you did by changing the names and I just checked and there are no entities with the same name on this map.
10-23-2013, 09:58 PM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#10
RE: Acid Scare

(10-23-2013, 09:58 PM)T122002 Wrote: I just tried exactly what you did by changing the names and I just checked and there are no entities with the same name on this map.

I will post a new, working script with the same function for you later today.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
10-24-2013, 10:45 AM
Find




Users browsing this thread: 4 Guest(s)