![]() |
A few script commands I need help with.
Could you possibly give me some sample scripts or just one for each that are fairly short and easy to understand for using in one of them Strequals, in another Tokenize,in another Tokenize2,and last but not definatly not least could I have a lot of help on Trigger Actions, cause I find if very hard to understand.
Thanks for everything |
Re: A few script commands I need help with.
Quote:
|
merlin:
i made a short thing when i used to play graal, lemme find it... |
here...
//Basic Well theres two main if (action)'s which when you open the npc edit window they are already there, those are, if (playerenters) { and if (playertouchsme) { now, those two commands are very important to most scripts, so knowing that much lets move on. /Adding an response to an action Well, the basic layout for action/response would be if (action) {response;} Now, let's replace the action with a real action, if (playertouchsme) { now we got that far, let's replace the response with a real response if (playertouchsme) {hide; //hides the npc sleep1; //the npc sleeps for one second show; //the npc shows again } //ends the reponse Now, after the if (action) we have a { to start the response and a } to end the response, and a ";" at the end of each part of the response eg:/ if (playertouchsme) {actions here;} eg:/ hide; Great, now we got the basics down lets move on to a little more advanced scripting. //NPCWs (none playable charcter weapons) NPCWs we've all used them at one point be it bomb or GP boots, NPCWs are all of those things you see when you press the "D" button. //Making NPCws NPCws are fairly simple, the structure of the npcw itself is ususualy two commands -toweapons -weaponfired now to incorperate that into what we know it would be something like this if (playertouchsme) {toweapons Test NPC;} //adds the weapons "Test NPC to your weapons list if (weaponfired) {say2 Weapontest;} //here is where you add the actions for what will happen if you fire them weapon aka press the "D" button. That's the basic layout of an NPCW which can ofcourse be altered with more advanced commands. //Timeouts Timeouts are a very key part in NPC scripting, they are often used to loop commands, for example if (playerenters) {timeout=.5;} //that tells the npc that it waits .5 seconds if (timeout) {lay2 goldrupee,playerx+1,playery; //that would be the command that would happen after a timeout and if another timeout is added after it will loop (see below) timeout=.5;} //adding another timeout so it stays looped and constantly does the if (timeout) action //Functions functions are a slightly more advanced type of scripting to keep things from having to be written out more then once for example if (playerenters) test(); //tells the npc that when a player enters it performs the function "test" function test() {playerx=30; //tells the npc what the function for test() is. playery=30;} //Strings Strings are a very important part of scripting needed for a lot of things. an example of a string would be if (washit) {setstring server.igothit,#v(strtofloat(#s(server.igothit))+1 );} which is basicly keeping track of how many times you got hit, that string adds +1 to the string server.igothit, you can also use local strings like client.igothit instead. So that string in the flags box would look like server.igothit=#oftimesyougothit. To display a string that would be changing you would make an npc like this if (playerenters) {timeout=.5;} //starting of the loop (see timeout) if (timeout) {message I was hit #s(server.iwashit) times;} //the #s is saying that it will display the string and the (server.iwashit) is telling it which string to display so you would see something like I was hit 3 times. |
...
|
ok...
NPC Code: hope this helped, e-mail me: [email protected] if u have ne further questions. |
Triggeraction
NPC Code: |
Im still lost in trigger action I got the rest down pat
|
hmmm triggeractions okeeee
1. we start with a short description Triggeraction is used to use code in another Players weapon or an NPC when it's at the position u trigger at... it's normally easier to use then callnpc or callweapon and pretty nice for interactions between players 2. example: the player has a weapon with following code in it: if(actionspin){ freezeplayer 1; setani spin,; } there is an NPC in the level with following ode in it: if(playerenters){ triggeraction playerx+1.5,playery+2,spin,; } what it does: when the player enters the level and he has a weapon with the first code in it, the player will do a spin move how?: oke when the player enters there is a triggeration with the name "spin" on the playerx and playery (there are 1.5 and 2 added because this will be the middle of the player and the triggeraction will work better) there are no parameters with it thats why there is nothing behind the last , so if the weapon gets an action with the name spin (there is alwas the word action before the command so gscript knows that is something it has to do when there is an triggeraction) the player will do this spin-move now another example like the copnet on NM there is a weapon for 2 players both must have these weapon if the script should work the script: if(playertouchsme){ toweapons Net; } //The part while using the weapon if(weaponfired){ setani jaxe,; triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,catch,; } //if u are catched if(actioncatch){ setani dead,; freezeplayer 3; } so what it does: when u fire the weapon it will set the players ani to jaxe then trigger in front of the player (at this place u don't need to know how to use vecx and vecy here u just have to know that the x and y of the triggeraction are in front of the player). The triggername is catch... if there is another player in front of the one using the net-weapon his weapon will get the name of the triggeraction so he is "triggered"... so the part if(actioncatch){ setani dead,; freezeplayer 3; } will be run... his ani is set to dead and he can't move for 3 seconds.... now something like the hat-giving-NPC both players have a weapon like this: the first player wears a hat with the name "hat1.png" codepart: if(playertouchsme){ toweapons Gievhat; } //Giving the hat if(weaponfired){ setani jaxe,; triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,givehat,#P(1); } //Getting the hat if(actiongivehat){ setplayerprop #P(1),#p(0); } what happens: if the first player wears a hat and uses the weapon in front of another player this other player will wear the hat too. how?: when the player fires his hatgiving weapon it will trigger in front of this player with the with the name "givehat" and the parameter #P(1) (Hat of the player) if there is another player in front of the player using the weapon he is triggered with the triggeractionname givehat then the code in if(actiongivehat){ runs. and the player gets the hat... setplayerprop #P(1),#p(0); so how to use parameters if u trigger a player u can giveout paramters with the triggeraction: triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,givehat,#P(1); here it is #P(1) thats the hat of the player these action can be read with #p(number) for the first paramter the number is 0 for the 2. one its 1 for the 3. its 2 etc. so u can give many things to the triggered player... for example: if(playertouchsme){ toweapons Gievhat; } //Giving the hat if(weaponfired){ setani jaxe,; triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,givehat,#P(1),#n; } //Getting the hat if(actiongivehat){ setplayerprop #P(1),#p(0); setplayerprop #c,Thanx for the hat #p(1); } here the triggered player will get the hat of the first player then he will say Thanx for the hat <here the nickname of the hat giver> so triggeraction is usefull for interactions... I hope this helped... |
Thanks, also where did you get that pic from you sig. Its cool.
|
very nice! :D
|
Quote:
|
| All times are GMT +2. The time now is 09:43 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.