Very basics

vespt

New Member
Reaction score
4
Well I was reading the tutorial from vexorian and I did this:

Code:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
  local real a=34.0
  local real b=2.2
  local integer c= a/b
    [B]call DisplayTextToForce( GetPlayersAll(), "c="+I2S(c) )[/B]
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Melee_Initialization, Player(0) )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

It says that the bold part is with error... can´t find it :X(nice start for me )

Thx in adv
 

quraji

zap
Reaction score
144
It's because you're making an integer equal to the division of two reals, which is a real. Try:

Code:
function Trig_Melee_Initialization_Actions takes nothing returns nothing
  local real a=34.0
  local real b=2.2
  local integer c= [B]R2I([/B]a/b[B])[/B]
  call DisplayTextToForce( GetPlayersAll(), "c="+I2S(c) )
endfunction

//===========================================================================
function InitTrig_Melee_Initialization takes nothing returns nothing
    set gg_trg_Melee_Initialization = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Melee_Initialization, Player(0) )
    call TriggerAddAction( gg_trg_Melee_Initialization, function Trig_Melee_Initialization_Actions )
endfunction

The native function R2I converts a real into an integer.

Also as a future guide, usually the error is on the line before the highlighted line.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top