![]() |
Send params to putnpc2?
I'm creating a projectile using putnpc2 but I want to send some data to it. It cant read from player.attr.
Is there any way to send some parameters to an NPC created using putnpc2 with a joined class? Thanks :) |
I doubt its the most efficient, but you could always pass them to a DB NPC and use
this.variable = FindNPC("NPC").variable; or set them to a temporary server variable? |
but how do i identify the npc when using findnpc?
There could be more than one instance of the projectile class. |
when the npc was created, make it save the npc id it was :o ( (npccount - 1) I think?), then use the npc id :]
|
Quote:
PHP Code:
PHP Code:
|
You mean..
HTML Code:
with (putnpc2(x, y, "join someclass;"))HTML Code:
temp.npc putnpc2(x, y, "join someclass;"); |
NPC Code: or so |
Quote:
"join(\"someclass\");" |
Quote:
|
Quote:
|
Quote:
@Riot Yea? I didn't know you could pull the object of a putnpc2 |
Quote:
|
Quote:
|
Quote:
|
ok, I found a better way.
looks messy, but works and should be more efficient than findnpc() PHP Code:
|
I've always done
PHP Code:
|
HTML Code:
with(putnpc2(this.x, this.y, "join object;")) |
I never knew that putnpc2() returned the npc object >_>
Hurray for new things. ^^ You could even add a putnpc3() that uses a class name to join as the parameter instead of the actual script :P with (putnpc3(this.x, this.y, "classname")) {} For the lazy people like me. |
putnpc3 doesnt exist?
|
Uh no, that was speculation.
|
PHP Code:
|
Yea you could do that easily enough, but having built in stuff is cooler than joining classes all the time :P
|
| All times are GMT +2. The time now is 05:30 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.