Frictional Games Forum (read-only)
How to use additementity and remove item? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to use additementity and remove item? (/thread-15432.html)



How to use additementity and remove item? - MissMarilynn - 05-15-2012

Hello! Could someone explain how to use the scripting for additementity and how to script a remove item entity?

Thanks!

OH and could I use this to set an area active? How would I do that?


RE: How to use additementity and remove item? - Stepper321 - 05-15-2012

AddUseItemCallback("", "itemname", "entityname", "function", true); // Put this in void OnStart



then you add this too (i will do a door example.)

void function(string &in asItem, string &in asEntity)
{
RemoveItem(asItem);
SetSwingDoorLocked(asEntity, false, true);
}
How this works is by asItem, it's an advanced Syntax sort to speak, it will to say it easily look at the name function, and then to the function as stated. and look at the part of the item, for asItem, and entity for asEntity. Now when you want another one.
Just add the same with function. so you can use it over and over again Big Grin! Yay?


RE: How to use additementity and remove item? - FragdaddyXXL - 05-15-2012

(05-15-2012, 01:40 PM)MissMarilynn Wrote: OH and could I use this to set an area active? How would I do that?
Inside Strepper's example function aptly named function, you can add:

if(asItem == "KeyThatActivatesArea")
{
AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
}

That will tell the engine to start looking for a collision between the player and the script area.


RE: How to use additementity and remove item? - Stepper321 - 05-15-2012

(05-15-2012, 06:25 PM)FragdaddyXXL Wrote:
(05-15-2012, 01:40 PM)MissMarilynn Wrote: OH and could I use this to set an area active? How would I do that?
Inside Strepper's example function aptly named function, you can add:

if(asItem == "KeyThatActivatesArea")
{
AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
}

That will tell the engine to start looking for a collision between the player and the script area.
You can also do it in the entities tab. ItemInteractCallback. It's syntax is
void name(string &in Entity) // Choose your own name (the one you put in ItemInteractCallback)
{
AddEntityCollideCallback(string& asParentName, string& asChildName, string& asFunction, bool abDeleteOnCollide, int alStates);
}

Wich one you prefer tough.


RE: How to use additementity and remove item? - MissMarilynn - 05-15-2012

Could I use RemoveEntity instead?

What I want to do is make a door disappear and make a destroyed one appear.


RE: How to use additementity and remove item? - Your Computer - 05-15-2012

(05-15-2012, 11:24 PM)MissMarilynn Wrote: Could I use RemoveEntity instead?

What I want to do is make a door disappear and make a destroyed one appear.

Swingdoors already do that when their health drops significantly.


RE: How to use additementity and remove item? - FragdaddyXXL - 05-16-2012

void SetPropHealth(string& asName, float afHealth);

That should do the trick, as Your Computer has said.


RE: How to use additementity and remove item? - MissMarilynn - 05-16-2012

so would this be correct:

SetPropHealth("mansion_2","0.0");


RE: How to use additementity and remove item? - FragdaddyXXL - 05-16-2012

Yup! That'll work.


RE: How to use additementity and remove item? - Stepper321 - 05-16-2012

(05-16-2012, 01:38 AM)MissMarilynn Wrote: so would this be correct:

SetPropHealth("mansion_2","0.0");
No, you don't put "0.0" at floats. It's 0 or 0.0f