![]() |
2 questions (server warp & putnpc2)
Okay. Firstly, I've made an NPC that when the player says /serverlist, a GUI window pops up. with a long list of servers. The player can select one, click connect, and will warp to that server.
Everything works just fine. Except for the fact that i don't know how to make serverwarp read a var. Currently it's: serverwarp this.selectedserverconnect; though i've tried serverwarp @ this.selectedserverconnect; and a few more. I just need the format. Also, in regards to putnpc2. This has drivin me crazy. Offline, I used putnpc to place a custom NPC (like, lets say it puts a bomb script that lays a bomb, that puts a few randomly sized explosions, in random areas within a certain area. I would put something like: PHP Code:
I started with rescripting it online in GS2. Though as I kept searching every available resource I could find for what I was doing wrong, and as my frustration grew, I eventually started rescripting it in GS1 (So I can get what I got in GS1, then once I have everything else set up, I could try attempting to convert it back to GS2.) Still had no luck of course. So could anyone please explain to me the correct format of putnpc2? (I.e. the format for putnpc (in GS1) is: putnpc image.png, script.txt, x, y; ) |
You should really indent your code, it helps us (and you) read the script easier,.
Basically the GS2 equivalent is: PHP Code:
Also, it should be: serverwarp(this.selectedserverconnect); |
Stryke is correct, but I would do something like
PHP Code:
As far as the script, you create a new class called 'classname' or whatever you specify it as in the other script, and put in your script as (for example) PHP Code:
PHP Code:
|
Why do:
for (temp.i = 3; i > 0; i --) { sleep(1); } instead of just doing sleep(3)? |
Quote:
|
Thanks you guys. I'll try that out.
Quote:
I've seen these alot. and apparently it can be very useful in certain script. Could someone explain how this works? Its always seemed very confusing to me. reading how "for" works in the offline editor helps a little, but what's it checking? and what exactly is that script doing? i would guess it's checking if temp.i = 3. or is it setting it to 3? then telling it it's greater than 0 then subtracting 1? or, by looking at Dusty's comment, is it producing three one second sleeps? then once temp.i == 0, it tells it to stop telling it to sleep.. or something? and where's it pulling the initial value for temp.i from anyway? |
Quote:
Quote:
Quote:
PHP Code:
Quote:
PHP Code:
PHP Code:
Quote:
PHP Code:
PHP Code:
Another, different type of for loop is like a foreach loop in other languages. It's done like this: PHP Code:
PHP Code:
PHP Code:
PHP Code:
Quote:
PHP Code:
|
Ah, I understand it now! Much thanks for the explaination Chris :D
Edit: Okay, as for the putnpc2 thing, i'm still having trouble. I got: PHP Code:
So i'm still stuck in the same place x_x |
onWeaponFired() and play() are both clientside functions.
PHP Code:
|
awesome, it works now :D
quick question though. that's the purpose of the "gui" in triggerserver? |
Quote:
"npc" is the other form that is used, and that is to trigger DB NPCs. |
alright. and yet another question if i might add, I fixed one of my other weapons. When fired, it creates an npc char that moves across the screen shooting arrows. then, once it has moved a certain amount, it calls its movement finished thing, then is told to destroy(); itself. The problem is, after that,if i use the update level command or reconnect, the npc will reappear. like it never actually got deleted. Do i need to destroy(); serverside or something?
|
Quote:
|
Quote:
|
Quote:
Sorry I didn't see that, I think you edited your post. EDIT: Nevermind, you didn't edit it, I quoted you. |
Quote:
My 5-6 years of scripting experience on the editor only required 2 things: 1. Some GS1 knowledge. 2. The "If it works the way you want it to one way, There's no reason to change it" mindset. Which allowed me to skip practicing with //#CLIENTSIDE completely. Also with the fact that since the editor IS clientside, i just mistook the thing as a //comment since it didn't seem to change or do anything. Which also makes it seem very VERY hard for me to get anything off clientside. Since I have nearly zero first-hand experience with calling parts of a script serverside FROM clientside and vice-versa. Since the editor uses nothing but clientside, I'm fairly comfortable with clientside. Of course, when I have something that needs to be serverside, tons of complications tend to arise. Also, another problem is I'd love to hire a scripter or two who knows what they're doing.. But the problem there is that there's no one I feel I could trust (Ever get those people who either randomly, out of the blue, pop up on your server asking to be Co-Manager, or Manager or some high up staff? Or those players who just want to be staff mainly for the RC and, as scripters go anyways, the manipulative scripts they can give themselves?) So right now, I really feel I'm stuck doing this solo for now. Anyways, If you want to take a look at the script. This is the best "working" version. PHP Code:
Also, the player is supposed to be able to improve the "skill level" of the weapon being the client.summonarcherallylevel variable. However, again, since it's all clientsided, Lets say, if i have a high skill level with it, i fire it, it explodes at the end. my friend nearby won't see the explosion since his client.summonarcherallylevel = 0. But now this also means when he uses it, since my client.summonarcherallylevel > 2, the explosion is on his too. though he doesn't see it. ..Along with the destroy() still being clientsided. I have 2 other attempts at this. I'm not quite sure which one (if either) is closer to what I need: PHP Code:
PHP Code:
And one more problem is that I don't quite know how to do is turn something like PHP Code:
Sorry for the HUGE post. |
Quote:
PHP Code:
I've always thought you had to use two equal signs when comparing two things but I guess it might've worked in GS1. You can't define a function on the serverside and expect to call it from the clientside. You have to use triggeraction, so try adding this to the serverside part of your code. PHP Code:
|
Quote:
Quote:
PHP Code:
|
All times are GMT +2. The time now is 03:55 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.