Frictional Games Forum (read-only)

Full Version: How to use additementity and remove item?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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?
(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.
(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.
Could I use RemoveEntity instead?

What I want to do is make a door disappear and make a destroyed one appear.
(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.
void SetPropHealth(string& asName, float afHealth);

That should do the trick, as Your Computer has said.
so would this be correct:

SetPropHealth("mansion_2","0.0");
Yup! That'll work.
(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