Jump to content

[Questions] I need help with this Script


reaper9111

Recommended Posts

Hello guy's i finally decided my self to give it a shot at scriptting, but i'm running into some lil misunderstanding issue here...

 

This script is to be attach to 5 different stone, each stone give a bonus spell to the player, everytime a stone is activated,

it removes any previous spell giving by the other stone. So only one bonus can be obtain at the same time...

 

My questions are this:

 

>>>This is a modifyed version of the DoomStone script, i do not want any choices, or message so i removed everything unwanted...

But i'm not too sure about the BOOL Property, are they Bool ? or something else snce the script is attach to each 5 stone...

>>> The Fuction AddSign ? is this gonna work in this case ? Or should it be AddSpell insted ?

>>> The Property GraphVariable, is this needed since there's nothing to animate related to the stone ?

Here's the script:

 

ScriptName RAPMagicSchoolStoneScript extends ObjectReference
  ;This Script is attach to each of the 5 magic stone each give a bonus to the player everytime a stone is activated
  ;It will remove the previous bonus so only one bonus can be added at once

import game
import utility

String property graphVariable auto

BOOL PROPERTY RAPIllusionStone AUTO
BOOL PROPERTY RAPRestorationStone AUTO
BOOL PROPERTY RAPAlterationStone AUTO
BOOL PROPERTY RAPDestructionStone AUTO
BOOL PROPERTY RAPCongurationStone AUTO

SPELL PROPERTY RAPIllusionStoneAbility AUTO
SPELL PROPERTY RAPRestorationStoneAbility AUTO
SPELL PROPERTY RAPAlterationStoneAbility AUTO
SPELL PROPERTY RAPDestructionStoneAbility AUTO
SPELL PROPERTY RAPCongurationStoneAbility AUTO


BOOL DOONCE=TRUE

Auto State base

EVENT onACTIVATE(OBJECTREFERENCE obj)
	
	IF(doOnce && obj AS ACTOR == game.getPlayer())
		
		doOnce = FALSE
		
		IF(RAPIllusionStone && game.getPlayer().hasSpell(RAPIllusionStoneAbility))
			utility.wait(2)
			doOnce = TRUE
		ELSEIF(RAPRestorationStone && game.getPlayer().hasSpell(RAPRestorationStoneAbility))
			utility.wait(2)
			doOnce = TRUE
		ELSEIF(RAPAlterationStone && game.getPlayer().hasSpell(RAPAlterationStoneAbility))
			utility.wait(2)
			doOnce = TRUE
		ELSEIF(RAPDestructionStone && game.getPlayer().hasSpell(RAPDestructionStoneAbility))
			utility.wait(2)				
			doOnce = TRUE
		ELSEIF(RAPCongurationStone && game.getPlayer().hasSpell(RAPCongurationStoneAbility))
			utility.wait(2)				
			doOnce = TRUE
		
		ENDIF
		
	ENDIF
endEVENT

endState


FUNCTION addSign()
IF(RAPIllusionStone)
	game.getPlayer().addSpell(RAPIllusionStoneAbility)
ELSEIF(RAPRestorationStone)
	game.getPlayer().addSpell(RAPRestorationStoneAbility)
ELSEIF(RAPAlterationStone)
	game.getPlayer().addSpell(RAPAlterationStoneAbility)
ELSEIF(RAPDestructionStone)
	game.getPlayer().addSpell(RAPDestructionStoneAbility)
ELSeIF(RAPCongurationStone)
	game.getPlayer().removeSpell(RAPCongurationStoneAbility)
ENDIF

EndFUNCTION


FUNCTION removeSign()
	
IF(game.getPlayer().hasSpell(RAPIllusionStoneAbility))
	game.getPlayer().removeSpell(RAPIllusionStoneAbility)

ELSEIF(game.getPlayer().hasSpell(RAPRestorationStoneAbility))
	game.getPlayer().removeSpell(RAPRestorationStoneAbility)		

ELSEIF(game.getPlayer().hasSpell(RAPAlterationStoneAbility))
	game.getPlayer().removeSpell(RAPAlterationStoneAbility)	

ELSEIF(game.getPlayer().hasSpell(RAPDestructionStoneAbility))
	game.getPlayer().removeSpell(RAPDestructionStoneAbility)	

ELSEIF(game.getPlayer().hasSpell(RAPCongurationStoneAbility))
	game.getPlayer().removeSpell(RAPCongurationStoneAbility)

ENDIF

endFUNCTION



State waiting
;do nothing
endState

Edited by reaper9111
Link to comment
Share on other sites

Try this (I haven't tried compiling it):

 

 

ScriptName RAPMagicSchoolStoneScript extends ObjectReference 
;	This Script is attach to each of the 5 magic stone each give a bonus to the player everytime a stone is activated 
;	It will remove the previous bonus so only one bonus can be added at once

; After attaching the script to a stone, set ONE of the bool properties to TRUE, corresponding to the type of stone.
BOOL PROPERTY RAPIllusionStone AUTO 
BOOL PROPERTY RAPRestorationStone AUTO 
BOOL PROPERTY RAPAlterationStone AUTO 
BOOL PROPERTY RAPDestructionStone AUTO 
BOOL PROPERTY RAPCongurationStone AUTO 

SPELL PROPERTY RAPIllusionStoneAbility AUTO 
SPELL PROPERTY RAPRestorationStoneAbility AUTO 
SPELL PROPERTY RAPAlterationStoneAbility AUTO 
SPELL PROPERTY RAPDestructionStoneAbility AUTO 
SPELL PROPERTY RAPCongurationStoneAbility AUTO

Actor Player

;*************************************************

AUTO STATE WAITING

EVENT onACTIVATE(OBJECTREFERENCE obj)

Player = Game.GetPlayer()

IF obj == Player
	GoToState("BUSY")

	; REMOVE SPELLS FROM OTHER STONES
	IF !RAPIllusionStone && Player.hasSpell(RAPIllusionStoneAbility)
                Player.removeSpell(RAPIllusionStoneAbility) 
	ELSEIF !RAPRestorationStone && Player.hasSpell(RAPRestorationStoneAbility)
       	        Player.removeSpell(RAPRestorationStoneAbility)                 
	ELSEIF !RAPAlterationStone && Player.hasSpell(RAPAlterationStoneAbility)
                Player.removeSpell(RAPAlterationStoneAbility)  
	ELSEIF !RAPDestructionStone && Player.hasSpell(RAPDestructionStoneAbility)
                Player.removeSpell(RAPDestructionStoneAbility)         
	ELSEIF !RAPCongurationStone && Player.hasSpell(RAPCongurationStoneAbility)
                Player.removeSpell(RAPCongurationStoneAbility) 
	ENDIF 

;		ADD NEW SPELL IF PLAYER DOESN'T HAVE IT ALREADY
	IF RAPIllusionStone && !Player.hasSpell(RAPIllusionStoneAbility)
		Player.addSpell(RAPIllusionStoneAbility) 
	ELSEIF RAPRestorationStone && !Player.hasSpell(RAPRestorationStoneAbility)
		Player.addSpell(RAPRestorationStoneAbility) 
	ELSEIF RAPAlterationStone && !Player.hasSpell(RAPAlterationStoneAbility)
		Player.addSpell(RAPAlterationStoneAbility) 
	ELSEIF RAPDestructionStone && !Player.hasSpell(RAPDestructionStoneAbility)
		Player.addSpell(RAPDestructionStoneAbility) 
	ELSEIF RAPCongurationStone && !Player.hasSpell(RAPCongurationStoneAbility)
		Player.addSpell(RAPCongurationStoneAbility) 
	ENDIF 

	GoToState("WAITING")	
ENDIF 
endEVENT

ENDSTATE

;*************************************************

STATE BUSY
ENDSTATE

;*************************************************

 

 

EDIT: I fixed a small bug.

Edited by steve40
Link to comment
Share on other sites

Yeah, i've notice... Thanks still for comming back and care...,

Right now, i have an other issue, not related to this... so the continuation of this pieces of the mod will probably take a lil more time than i though...

But i'll be back (probably via a pm to let you know how it goes...) Credit will be given to you for the script my friend !

 

Thanks for helping me, this is truly very appreciated ! (i only hope i had more help on many other script...) My mod would be very different than... Aniway...

Reaper

Link to comment
Share on other sites

  • Recently Browsing   0 members

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