Scripting, cant get a private variable to function as needed

Post » Mon Jun 18, 2012 11:03 pm

Ok guys I am having trouble with this script...


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

float weaponrighthandsaved ; these are the private variables
float weaponlefthandsaved


Event OnUnequipped(Actor akActor)

weaponrighthandsaved = Game.GetPlayer().GetItemCount(WeaponRightHandToken)
weaponlefthandsaved = Game.GetPlayer().GetItemCount(WeaponLeftHandToken)

endevent


Event OnEquipped(Actor akActor)

if (Game.GetPlayer().GetEquippedWeapon(false) == EquippedWeapon) ; this weapon now equipped in right hand
Game.GetPlayer().AddItem(weaponrighthandsaved, 1, false) ; does not work keep getting CK complain report
endif

endEvent

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

What I want is to get the variable (marked in bald) to work but I am unsure of the correct function command.

:stare:
User avatar
pinar
 
Posts: 3453
Joined: Thu Apr 19, 2007 1:35 pm

Post » Tue Jun 19, 2012 2:20 am

At the moment, you're trying to tell the player to equip a number. Note that http://www.creationkit.com/AddItem_-_ObjectReference requires a http://www.creationkit.com/Form_Script as its first parameter.

P.S. Please give http://www.gamesas.com/topic/1347469-how-to-ask-for-scripting-help/ a quick read.

Cipscis
User avatar
sarah
 
Posts: 3430
Joined: Wed Jul 05, 2006 1:53 pm

Post » Tue Jun 19, 2012 2:56 am

At the moment, you're trying to tell the player to equip a number. Note that http://www.creationkit.com/AddItem_-_ObjectReference requires a http://www.creationkit.com/Form_Script as its first parameter.

P.S. Please give http://www.gamesas.com/topic/1347469-how-to-ask-for-scripting-help/ a quick read.

Cipscis

EDIT: Even though the script has been changed to the following I still get CK complaint:

Event OnEquipped(Actor akActor)

if (Game.GetPlayer().GetEquippedWeapon(false) == EquippedWeapon) ; this weapon now equipped in right hand
Game.GetPlayer().AddItem(WeaponRightHandToken, weaponrighthandsaved, false) ; does not work keep getting CK complain report
endif

endEvent

:cool:
User avatar
Claudia Cook
 
Posts: 3450
Joined: Mon Oct 30, 2006 10:22 am

Post » Tue Jun 19, 2012 12:42 am

Changed but still getting the error.

:dry:
User avatar
Richus Dude
 
Posts: 3381
Joined: Fri Jun 16, 2006 1:17 am

Post » Mon Jun 18, 2012 4:10 pm

Like I said in the post I asked you to read:
  • Please post your scripts in code boxes so they're easier to read (with indentation too)
  • If your script won't compile, please post the entire script and all compiler errors
Cipscis
User avatar
john palmer
 
Posts: 3410
Joined: Fri Jun 22, 2007 8:07 pm

Post » Mon Jun 18, 2012 1:54 pm

Like I said in the post I asked you to read:
  • Please post your scripts in code boxes so they're easier to read (with indentation too)
  • If your script won't compile, please post the entire script and all compiler errors
Cipscis

Nevermind I figured it out, I was using "float" when i should have been using "int" which makes sense since I have no idea what both are...

:confused:
User avatar
Karen anwyn Green
 
Posts: 3448
Joined: Thu Jun 15, 2006 4:26 pm


Return to V - Skyrim