![]() |
A pretty simple script not working online
Im an ET on server Dynasty, and I don't understand why this script won't work. Its supposed to warp the player on top of the winners platform if they touch the npc with a bush. It works offline, when its uploaded, no work.
if (playertouchsme && carriesbush){ with (getplayer(#a)){ setcharprop #c,#a; hide; setlevel2 bushrace2.nw,33.5,30.5; } } if (playerchats && strequals(#c,/reset)){ if (strequals(#g,Events Admin) || strequals(#g,Events Team)){ show; } } //#CLIENTSIDE if (created) { // Initialize the attributes showcharacter; setcharprop #3,head7.png; setcharprop #C0,orange; setcharprop #C1,darkblue; setcharprop #C2,brown; setcharprop #C3,black; setcharprop #C4,brown; setcharprop #2,no-shield.gif; shieldpower = 1; dir = 2; setcharprop #c, Touch me to win!; } |
Well it's quite hard to tell who one when some 1 could touch it straight after some 1 else as and it would appear to have him as the winner...
I think the problem is if (playertouchsme && carriesbush){ add a timeout and try it :o? Or make it so if you pelt it it executes it ;)? |
where to put the timeout and how long is the timeout, and why will this make it work?
|
It's worth a try, your telling me you don't know timeout's but you know quite complex commands such as with(getplayer(account))?
|
:) Where should I put the timeout is what im asking and how long should I make it for.
|
I am guessing this is with an NPC-Server. The NPC may not know that the player is touching it, use setshape. I don't think with(getplayer()) is actually necessary in this case.
|
That would help :)
|
How do I get the size of it?
|
It's 2 tiles wide and 2 high. Use
setshape 1,width,height; Where width is the width of tiles * 16, and the height is the height of tiles * 16. |
should i place this under if created and should it be client or serverside
|
1 Attachment(s)
NPC Code: If the setshape isn't used, it isn't an 'object', but just decoration, kinda. Read the attached text trough... it will increase your knowledge. |
if (created){
setshape 1,48,48; } if (playertouchsme && carriesbush){ with (getplayer(#a)){ setcharprop #c,#a; hide; setlevel2 bushrace2.nw,33.5,30.5; } } if (playerchats && strequals(#c,/reset)){ if (strequals(#g,Events Admin) || strequals(#g,Events Team)){ show; } } //#CLIENTSIDE if (created) { // Initialize the attributes showcharacter; setshape 1,48,48; setcharprop #3,head7.png; setcharprop #C0,orange; setcharprop #C1,darkblue; setcharprop #C2,brown; setcharprop #C3,black; setcharprop #C4,brown; setcharprop #2,no-shield.gif; shieldpower = 1; dir = 2; setcharprop #c, Touch me to win!; } Thats the new script, doesn't work :( |
Btw im testing this in online mode
|
NPC Code: I rearranged stuff in your script. I'm not really sure if this works since I haven't tested it. |
Still doesn't work, Stefan, where are you!?!?!?!
|
You might want to read up about how to use serverside stuff and clientside.
setlevel2 and with are serverside commands and such. Use a //#CLIENTSIDE tag to seperate clientside and serverside. You're also making a mountain out of a speedbump problem. |
The problem is "carriesbush". Stefan loves to make everyone rescript everything nowadays. The NPC Server apparently doesn't have detection for whether or not a player is carrying a bush.
Solution: Do the playertouchsme detection clientside (where carriesbush still works) and trigger serverside. If you wanted it more secure, check the coordinates of the player sending the trigger to make sure they're within a close enough distance to truly be touching the NPC. |
can you triggeraction from clientside to serverside? like triggeraction from if player touchs me to test if they have a bush and then triggeraction back to serverside for warp.
|
Quote:
That's what I was suggesting you do. Check if (playertouchsme && carriesbush) clientside... then trigger serverside telling the script that it's been touched while carrying a bush. Do some coordinate checking on the serverside trigger... then you can do your warping stuff. |
Ah ok, I just did the reverse of what you said lol.. I tried to check if player is touched and then go to client then go back hehe.
Ill try your way :) Im a bit confused on x,y ???? what if i dont want to check if it happens at an x, y ? wow the first time i saw trigger action (bout 8 months ago) i figured ill never touch this thing too confusing, seems a bit easier now that its been explained what it does. |
That's the position at where the action occurs, use x,y or 0,0.
|
Quote:
|
Doesn't seem to detect the trigger action =\
if (actionplayerwins){ setcharprop #c, Detected triggeraction!; sleep 1; with (getplayer(#a)){ setcharprop #c,#a; hide; setlevel2 bushrace2.nw,33.5,30.5; setcharprop #c, Complete!; } } if (playerchats && strequals(#c,/reset)){ if (strequals(#g,Events Admin) || strequals(#g,Events Team)){ show; } } //#CLIENTSIDE if (playertouchsme){ setcharprop #c, Detected Touch!; sleep 1; if (carriesbush){ setcharprop #c, Detected Bush!; sleep 1; triggeraction x+.5,y+.5,playerwins,; } } if (created){ showcharacter; //setshape 1,48,48; setcharprop #3,head7.png; setcharprop #C0,orange; setcharprop #C1,darkblue; setcharprop #C2,brown; setcharprop #C3,black; setcharprop #C4,brown; setcharprop #2,no-shield.gif; shieldpower = 1; dir = 2; setcharprop #c, Touch me to win!; } |
You need to have a setshape serverside. Without it, the server doesn't know how big the NPC is... therefore it can't receive a trigger.
Btw, the with () isn't necessary. The script will already be "attached" to that player... so things can be directly edited. Besides... you're attempting to set NPC properties inside the player's with () block. |
Thank you all of you for your help.
Here is the complete and working script for those who want it. Thanks especially to ramirez. NPC Code: |
AAAAARRRGGG
I need to check this forum more often i guess x-x 1. PLEASE move the if (created) stuff to the serverside, how should the player be able to touch the npc if the npcserver doesn't event know that the npc is visible? since you only display stuff on the clientside; move it and you don't need weird stuff like setshape or whatever 2. with (getplayer(#a)) is completely nonsense, please kill the one who teached you such stuff 3. the stuff about the carriesbush is right - its from the old classic clientside-only mode and not supported anymore; you can still possible detect it on clientside and then send a trigger to the serverside which is warping you |
Never seen Stefan so evil. :p
|
x.x, I always thought when showing a character it was to be done on the client.
|
Quote:
You can do all initializations on the serverside, its faster anyway and causing less traffic since the script doesn't need to be sent to the client, and the npcs actually see each other then ;) You can also drawoverplayer, drawunderplayer etc. on the server, don't know why some people always put that in the clientside part. The only problem is when you do lights or similar things, the commands setcoloreffect, setzoomeffect and seteffectmode only work on clientside. |
Quote:
|
Quote:
The npcserver is doing all the npc stuff anyway, the question is if the thing needs to be sent to the client. If you do the initialization on the clientside then the npcserverr is bored, but needs to send the script to everyone who enters the level, the players then need to run the script which cause even more lag because entering the level causes delays from downloading the npcs, downloading the scripts and running the scripts. When you do that on npcserver it just needs to be done one time and everything is fine. That is actually the purpose of the npcserver, doing the npcs |
Quote:
:(. |
Stefan, here's something for you to fix, since you say we should do it serverside.
Try putting this in a new NPC: NPC Code: When you enter the level, you'll notice it has red and black for its outfit. It doesn't use the colors specified. At least... this is what happens on Classic Dev. |
Quote:
|
Well I didn't tell him to do that.
I told him if that bush flag didn't work to try checking #m for carrying. |
So how would I do a lights on / off script for everyone to see? A triggeraction from server to client?
Also, if I select an image for the npc, do I need to set a shape? |
Wavy Vision for drunk effect?
what command would I use if one at all?
Also how would I have a timer that slowly brings down drunk level? |
Custom Swords and Weapons
Again, im wondering what commands it'll take. What will I need to use? Im guessing setcharani, freezeplayer, but I really have no clue on hit detection. =\
|
Triggeraction
Can a trigger action detect an NPC thats in a players inventory?
Sorry for all the posts, but im not jus goin 2 cram em all into one :) |
seteffect, setfocus.
|
| All times are GMT +2. The time now is 10:26 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.