Jump to content

Scripting question


porroone

Recommended Posts

So im trying to make my weapon show a message when its drawn, but im not havin much luck, I dont know how the OnUpdate event operates so I was hoping someone could shed some light into it. Here is the code:

Scriptname TestScript extends ObjectReference	

Weapon Property WarGlaiveR auto
Actor Property Player auto

Function Register(Actor akActor)
akActor.RegisterForUpdate(1)
Debug.MessageBox("registed")
endFunction

auto State Iddle
Event OnEquipped(Actor akActor)
	Register(akActor)
	GoToState("Update")	
endEvent
endState
State Update 
Event OnUpdate()
	if Player.IsWeaponDrawn()
		Debug.MessageBox("hello there")
	endIf
endEvent
Event OnUnequipped(Actor akActor)
	Debug.MessageBox("Back to idle")
	UnRegisterForUpdate()
	GoToState("Iddle")
endEvent	
endState

 

As you can see basically what im trying to do is to trigger the OnUpdate event when the weapon is equipped and once there well, the first line is to check if the Player has a weapon drawn, that much works since I tested it on the OnEquipped and OnUnequipped events, the OnUpdate event doesnt tho, I tried to add a Message box in the first line just to check if it was even registering the event but it seems it doesnt do anything.

Edited by porroone
Link to comment
Share on other sites

Ok now, seems like what I was trying to do is either impossible through scripting or just more complex than I though, so basically what I wanted to do is make my 1h sword appear on the back using the SetAngle function, but looks like that only works for players, whenever I try to do that on a Weapon or Object it just says the function doesnt exist, so if anyone knows how to do what im trying to do but failing to do, I would really appreciate the help else thanks anyway because im THAT NICE.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...