Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #19  
Old 05-01-2009, 02:00 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Raelyn View Post
Awesome.

Another thing, I was under the impression that variable type is automatically detected, but it seems like setting a variable to a string of text doesn't work?

Trying to do something like this:

PHP Code:
clientr.weapon_img weaponname.png;

if (
trigger){
   
showimg index,clientr.weapon_img,,,;

Use:

PHP Code:
clientr.weapon_img "weaponname.png"
for strings

Quote:
Also, I tried using:

PHP Code:
function onKeyPressed(codekeychar) {
  if (
key == "p") {
    
temp.img findImg(200);
    
img.visible = ! img.visible;
  }

Not sure how to implement this, as a function, isn't it redundant to do this?:

PHP Code:
if (keypressed){
  
onKeyPressed(,p,);

onKeyPressed is called on default. Basically all of the event if's were converted to "function onEvent", such as "onPlayerTouchsMe", "onCreated", and "onPlayerEnters". There's no need for the if (keypressed) statement.

Quote:
Hrrm, am I doing this properly?


Doesn't this work?

PHP Code:
showimg 200,imagename.png,,,;
hideimg 200;

if (
keypressed) {
  if (
strequals(#p(1),p)) {
    
temp.img findImg(200);
    
img.visible = ! img.visible;
  }

hideimg might be actually destroying the image (actually, I'm pretty sure it does). Just hide it with findImg().visible. And, I don't think showimg has that many paramaters.

Plus.... you're combining GS1 and GS2 in a horrible way

Quote:
Originally Posted by Raelyn View Post
Ugh, I don't know how else to do this.

I want the weapon icon to be displayed dependant on the type of weapon equipped, so..

PHP Code:

if (clientr.weapon 0001;){
   
clientr.weapon_img weaponicon.png;
}

showimg indexclientr.weapon_img,,,; 
Something like this I guess...

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.wep_type.sword "sword.png";
}
function 
displayImage() {
  
showimg(200getImageForType(clientr.weaponType), 00);
}
function 
getImageForType(wep) {
  return 
this.wep_type.(@ wep);

and just set clientr.weaponType or another variable when you change the player's weapon. Also, there's really no reason to use clientr. for a weapon image.

And, I'm pretty sure you're adding an extra parameter to showimg almost everywhere. Press F2 and click on "Scripts", it may be giving an error.
__________________
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:15 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.