Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-08-2004, 04:22 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
Ok new p[roblem il lcontinue on this thread..... how do you set the players weapon with a script so that the player wuldnt do it manually, i.e a hotkey script?
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #2  
Old 08-08-2004, 05:37 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally Posted by falco10291029
Ok new p[roblem il lcontinue on this thread..... how do you set the players weapon with a script so that the player wuldnt do it manually, i.e a hotkey script?
Use keydown and setplayerprop #w, perhaps? I'm not a good scripter yet, so I wouldn't know.
Reply With Quote
  #3  
Old 08-08-2004, 08:54 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
setplayerprop#w doesnt work i have tried that that was my first attempt i tried both clientsided and serversided
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #4  
Old 08-08-2004, 09:29 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally Posted by falco10291029
setplayerprop#w doesnt work i have tried that that was my first attempt i tried both clientsided and serversided

You could do a check of the client's inventory and use addweapon, since the newest weapon is always the one that is selected first. I don't know if this is secure or not though.
Reply With Quote
  #5  
Old 08-08-2004, 09:49 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Split to another thread, please refer to the rules.

As for your question, use a for loop to go through the player's weapon IDs, then check if the #w (weaponname) of that ID is the one you want. Hint: #w can take a param in the form of a weapon's ID.

Quote:
Originally Posted by protagonist
Use keydown and setplayerprop #w, perhaps? I'm not a good scripter yet, so I wouldn't know.
If you don't know what you're doing, please don't try to give advice to others.

Last edited by Lance; 08-08-2004 at 10:20 PM..
Reply With Quote
  #6  
Old 08-08-2004, 10:17 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
wait what exactly do u mean a for loops? I dont know how it uld set it though pleas ebe a little more clear and sorry i started what shuld have been a diff thread
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #7  
Old 08-08-2004, 10:26 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by falco10291029
wait what exactly do u mean a for loops? I dont know how it uld set it though pleas ebe a little more clear and sorry i started what shuld have been a diff thread
This is a for loop:

NPC Code:
for (initial-condition;test-condition;increment-op) {
//put code here that is executed each iteration
}



Read up on for loops to get a good understanding of what each of these parts is, but I will give you another hint for after you have done so: You will want to loop through until the weaponscount. That'll be part of your your test condition.
Reply With Quote
  #8  
Old 08-08-2004, 10:44 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Perhaps it is nice to know to do selectedweapon = i too.
Reply With Quote
  #9  
Old 08-08-2004, 10:46 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by Loriel
Perhaps it is nice to know to do selectedweapon = i too.
That would be the coup de grace.
Reply With Quote
  #10  
Old 08-08-2004, 11:13 PM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
um i know how for loops worked i mean how wuold that help u select a wepon theres no command that i know of that will actually set your wepon even if u find the right one!
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #11  
Old 08-08-2004, 11:35 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
Quote:
Originally Posted by falco10291029
um i know how for loops worked i mean how wuold that help u select a wepon theres no command that i know of that will actually set your wepon even if u find the right one!
Iterate through weaponscount. Check if #w(yourvar) is the same as the weapon name you want selected. If it is, use the assignment Loriel supplied.
Reply With Quote
  #12  
Old 08-09-2004, 12:37 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
ok Let me see if i can get this straight. Your saying I should do smething lilke this for selecting the weapon

NPC Code:

for (i=o;i<weaponscount;i++) {
if (strequals(#w(i),#s(client.letter))///ud have to see my script to get it) {
selectedweapon=i;
break;
}

}




AM I right? Well I will try it.
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #13  
Old 08-09-2004, 12:48 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Looks right.
Reply With Quote
  #14  
Old 08-09-2004, 01:07 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
It works now i just have to fix it up so it works with two ro three word wepon names since it works by a chat command and tokenizing but i can figure that out i think
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
  #15  
Old 08-09-2004, 02:02 AM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Use #e....
Reply With Quote
  #16  
Old 08-09-2004, 03:00 AM
VeX_RaT_Boy VeX_RaT_Boy is offline
WannaBe Scripter
VeX_RaT_Boy's Avatar
Join Date: Aug 2002
Location: Norway
Posts: 960
VeX_RaT_Boy is on a distinguished road
Send a message via ICQ to VeX_RaT_Boy Send a message via AIM to VeX_RaT_Boy Send a message via Yahoo to VeX_RaT_Boy
Quote:
Originally Posted by falco10291029
*script*

AM I right? Well I will try it.
You miss a ')' in the condition there.

Also:
NPC Code:
for (i=o;i<weaponscount;i++)



You have 'o' there not '0' (zero). This works, because the variable 'o' has not been set to anything, so it is zero. But if you need to use the var 'o' once, you shouldn't have it in the for loop... This will not be a problem if you don't set 'o' or you can just use zero there.
__________________
-Kjetil Valen
Reply With Quote
  #17  
Old 08-09-2004, 04:33 AM
falco10291029 falco10291029 is offline
BEst User EVER!
Join Date: Apr 2004
Posts: 1,186
falco10291029 is on a distinguished road
oh oops and how would i use #e? do u do like #e(6,-3,#c) or soemthing? For now i have it so it tells you to just put quotes around it since that makes it 1 word
__________________
BEst Insult ever: If I had a dollar for every brain you DIDNT have, i'd have one dollar!
Reply With Quote
Reply


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 01:25 PM.


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