Frictional Games Forum (read-only)
Help,multiple scripts in one map! - 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: Help,multiple scripts in one map! (/thread-11992.html)

Pages: 1 2 3


Help,multiple scripts in one map! - Datguy5 - 12-21-2011

Can someone tell me how to put multiple scripts into one level?Heres what i've putted so far:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

All that works fine,but can someone please tell me how to put multiple scripts into one map?!(Btw sorry for the bad english ^^)




RE: Multiple scripts in one map. - stokesie95 - 12-21-2011

what you need to do is to put it like this



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}




RE: Multiple scripts in one map. - Datguy5 - 12-21-2011

(12-21-2011, 08:21 PM)stokesie95 Wrote: what you need to do is to put it like this



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh so does that make the statue appear?Thank you!Now if i only would know how to put multiple scripts into one map Cool


EDIT:Yes it works!Thank you mister.But how do you add a sound when it appears.I was planning to add scream or some sort of wind soundeffect.




RE: Multiple scripts in one map. - SpudroSpadre - 12-23-2011

(12-21-2011, 09:12 PM)Datguy5 Wrote:
(12-21-2011, 08:21 PM)stokesie95 Wrote: what you need to do is to put it like this



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh so does that make the statue appear?Thank you!Now if i only would know how to put multiple scripts into one map Cool


EDIT:Yes it works!Thank you mister.But how do you add a sound when it appears.I was planning to add scream or some sort of wind soundeffect.
Well, I'm really new to this scripting and shit but I guess you could use PlaySoundAtEntity ? Tongue




RE: Multiple scripts in one map. - Datguy5 - 12-23-2011

(12-23-2011, 10:55 AM)SpudroSpadre Wrote:
(12-21-2011, 09:12 PM)Datguy5 Wrote:
(12-21-2011, 08:21 PM)stokesie95 Wrote: what you need to do is to put it like this



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh so does that make the statue appear?Thank you!Now if i only would know how to put multiple scripts into one map Cool


EDIT:Yes it works!Thank you mister.But how do you add a sound when it appears.I was planning to add scream or some sort of wind soundeffect.
Well, I'm really new to this scripting and shit but I guess you could use PlaySoundAtEntity ? Tongue
Maybe Big Grin But where should i put it?





RE: Multiple scripts in one map. - stokesie95 - 12-29-2011

sorry it took so long to reply



you would use


////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("sound name", "file name including the file type eg .ogg", "statue's name", , );
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



RE: Multiple scripts in one map. - Datguy5 - 12-31-2011

(12-29-2011, 07:47 PM)stokesie95 Wrote: sorry it took so long to reply



you would use


////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("sound name", "file name including the file type eg .ogg", "statue's name", , );
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh ok ill give it a try.

EDIT:It didnt work Sad heres the crash report:FATAL ERROR:could not load script file
'custom_stories/Test/custom_stories/Test/maps/Test.hps'!
main(15,63):Err:Expected expression value




RE: Multiple scripts in one map. - stokesie95 - 12-31-2011

(12-31-2011, 12:18 AM)Datguy5 Wrote:
(12-29-2011, 07:47 PM)stokesie95 Wrote: sorry it took so long to reply



you would use


////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("sound name", "file name including the file type eg .ogg", "statue's name", , );
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh ok ill give it a try.

EDIT:It didnt work Sad heres the crash report:FATAL ERROR:could not load script file
'custom_stories/Test/custom_stories/Test/maps/Test.hps'!
main(15,63):Err:Expected expression value


got it working and i have tested



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("", "file_name", "entityName", 0, false);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



RE: Multiple scripts in one map. - Datguy5 - 01-01-2012

(12-31-2011, 11:43 AM)stokesie95 Wrote:
(12-31-2011, 12:18 AM)Datguy5 Wrote:
(12-29-2011, 07:47 PM)stokesie95 Wrote: sorry it took so long to reply



you would use


////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("sound name", "file name including the file type eg .ogg", "statue's name", , );
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Ohh ok ill give it a try.

EDIT:It didnt work Sad heres the crash report:FATAL ERROR:could not load script file
'custom_stories/Test/custom_stories/Test/maps/Test.hps'!
main(15,63):Err:Expected expression value


got it working and i have tested



////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "ScriptArea_1", "Woho", true, 1);

}

void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("statue's_name", true);
PlaySoundAtEntity("", "file_name", "entityName", 0, false);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

I want the sound to be a scream so do i use this:04_scream.snt




RE: Help,multiple scripts in one map! - stokesie95 - 01-01-2012

yes you would