The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help with several scripts.
Randael Offline
Junior Member

Posts: 7
Threads: 1
Joined: Jun 2012
Reputation: 0
#1
Question  Need help with several scripts.

Well, I have been trying to work around quite alot, trying to somehow edit already existing tutorial scripts (the exploding door for example) to work for my cause, but really nothing seems to work right. Ive been searching around quite a lot ... so here are my problems, im gonna try to make it as detailed as possible:

--Board problem was solved:
void OnStart()
{
    AddUseItemCallback("", "name_of_item", "name_of_entity", "name_of_callback", true);
}

void name_of_callback(string &in item, string &in entity)
{
    SetPropHealth(entity, 0);
    RemoveItem(item);}


Thx to Your Computer =)

-PROBLEM KINDA SOLVED!:

Then i have a problem with a Gate... a portcullis...cant actually call it a "swing"door i suppose.. There´s supposed to be a broken lever-hatch next to it with the lever lying around somewhere(i planned it so that the player needs to find the lever, insert it into the hatch, and then use it to open the Gate) ...
i searched around a bit, and didnt actually tried coding it, since it prolly is far too high forme. (im bloodyly new), i tried using a normal lever instead, but that just gave me errors aswell (the typical wrong signature or expected identifier stuff). I really would appreciate it if someone could give me a base-code i can orientate myself on there(or the complete one, which would be awesomexD I simply need to know what i need to lookout for).

--What do i need to attach a lever-handle to a broken hatch(small lever small hatch), making them 1 to open a gate, and if how to actually make it open the gate(a portcullis)?

-PROBLEM KINDA SOLVED!: (thx to myself)

Void OnStart()  {
AddEntityCollideCallback("lever1hatch", "llevergate1" , "func_levergate1", true, 1);
}
void func_levergate1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("lever1hatch" , false);

SetEntityActive("l1l" , true);

SetEntityActive("llevergate1", false);

SetMoveObjectStateExt("gate1", 1.0f, 0.05f, 0.1f, 0.5f, true);

SetLeverStuckState("lever1lever", 1, false); }


---------------------------------------------------------------------------------------------------------------------------
Opens gate, wout lever use though, and lever wont get stuck
---------------------------------------------------------------------------------------------------------------------------

--PROBLEM SOLVED

//Inside the door slam function:
void Doorslamfunction(whatever callback you used)
{
SetEntityPlayerInteractCallback("DoorNameHere", "DisplayText", false);
}
//Anywhere not inside a function, like OnStart():
void DisplayText(string &in asEntity)
{
SetMessage("Locked", "Basement", 0);
}
for the .lang file:
< LANGUAGE>
< CATEGORY Name="Locked">
< Entry Name="Basement">The door is locked. Damn!</Entry>
< /CATEGORY>
< /LANGUAGE>

--PROBLEM SOLVED( a bit different but who cares, it works)-- (thx to FastHunteR) How do I make a message using the if/else command appear when trying to open a swing door after an event occured? (door slammed shut behind the player and got locked).


Then I have a problem using the insanity crawl sound... i kinda would love it to play through but its only playing once ( like a second or 2) i would use the insanity effect aswell, but ... ive heared its not rly easy to work with them.
Void OnStart() {AddEntityCollideCallback("Player", "script_steps-ttr", "sstt1", true, 1);
AddEntityCollideCallback("Player", "script_steps-ttr2", "sstt2", true, 1);} void sstt1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sstt1", "insanity_step_crawl", "script_steps-ttr", 0.0, false);
}

void sstt2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("sstt2", "insanity_step_crawl", "script_steps-ttr2", 0.0, false);
}

AddEntityCollideCallback("Player", "script_steps-ttr", "sstt1", true, 1);
AddEntityCollideCallback("Player", "script_steps-ttr2", "sstt2", true, 1); }

What do i need todo so it keeps playing for a while? maybe till a few seconds after the door shut scare? (slowly fading out... as if he/she/it is moving away from the door that slammed shut)
Im sorry for this amount of questions, but i really have problems getting around this, and its really hard(and demotivating) to work without a solid base, i most likely wont be able to get it working if i dont see a solid script that actually works , which I can use to orientate myself on in future trys.

(PS: please mention what should get into the OnStart section and whatnot... that stuff has been confusing me since)

Im looking forward to every tip or code I can get, if its just for 1 of those problems or for all of them together (I actually thought about writing a wiki/guide myself with the information i gather... i mean... who could explain a noob how to programme better then another noob? lol) . It would be for my usage too though, since i always can check back how i worked on something to get it working, which hopefully will reduce the amount of mistakes i do over time.

ADDS:

<LANGUAGE>

<CATEGORY Name="CustomStoryMain">

<Entry Name="Description">
Prepare for something worse...
</Entry>

</CATEGORY>

<CATEGORY Name="Inventory">

<Entry Name="ItemName_chamberkey">Blood stained key</Entry>

<Entry Name="ItemDesc_chamberkey">A key with lots of dryed blood on it.</Entry>

<Entry Name="ItemName_crowbar1">Blood stained crowbad</Entry>

<Entry Name="ItemDesc_crowbar1">A crowbar, looks like it was used quite often , but not for its usual purpose...</Entry>

</CATEGORY>


</LANGUAGE>
Any1 sees any mistake there? it just wont show ingame... only the description of the map.

Randael
(This post was last modified: 06-26-2012, 10:16 PM by Randael.)
06-22-2012, 11:28 PM
Find


Messages In This Thread
Need help with several scripts. - by Randael - 06-22-2012, 11:28 PM
RE: Need help with several scripts. - by Randael - 06-23-2012, 03:05 PM
RE: Need help with several scripts. - by Randael - 06-23-2012, 06:09 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 09:19 PM
RE: Need help with several scripts. - by Cruzore - 06-26-2012, 09:54 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 10:04 PM
RE: Need help with several scripts. - by Cruzore - 06-26-2012, 11:04 PM
RE: Need help with several scripts. - by Randael - 06-26-2012, 11:31 PM
RE: Need help with several scripts. - by Cruzore - 06-27-2012, 12:46 PM
RE: Need help with several scripts. - by Cruzore - 06-28-2012, 12:15 AM
RE: Need help with several scripts. - by Randael - 06-28-2012, 09:43 AM



Users browsing this thread: 1 Guest(s)