![]() |
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. |
All times are GMT +2. The time now is 08:07 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.