Monday, 2024-05-20, 2:37 AM


Main
Registration
Login
Welcome Guest | RSS  
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 2
  • 1
  • 2
  • »
Forum moderator: JonNny, Hanky  
Clan NgO Forums » Discussions » Flood Dimension » Question to the teacher. :) (Some questions)
Question to the teacher. :)
TheCheeseLoverDate: Sunday, 2008-12-07, 0:55 AM | Message # 1
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
WOOHOO! I learned how to use local variable, how to use unit ( gg_unit_Hblm_0000 ), how to use spell and how to create a speacial effect. biggrin
(Sorry for the mistake: *Question for the teacher.)

First question: How to make a special effect in the air?

Second question: how to make a lightning effect in the air?

Third question: What is a private constants variable?

4: What mean GS_(a function)( the GS)?


Yay I have a signature. You suck. :D

Message edited by TheCheeseLover - Sunday, 2008-12-07, 5:05 AM
 
Darkt3mpl3rDate: Sunday, 2008-12-07, 5:16 PM | Message # 2
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
Hey CheeseLover,

Good to see your progress in JASS!

So creating a special in the air is a bit tricky. We'll use a dummy unit which is being set to a specific fly height and add attach special effect to the unit itself. Thus it looks like a special effect is being created in the air. Here's an example code snippet just written by myself.

Code
function AddSpecialEffectHeightLoc takes string whichPath, location whichLoc, real whichHeight, real whichDuration returns nothing
     local real dz  = GetLocationZ(whichLoc) + whichHeight    
     local unit gfx = CreateUnit(Player(15), 'e000', GetLocationX(whichLoc), GetLocationY(whichLoc), 0.)
     call UnitAddAbility(gfx, 'Amrf')
     call UnitRemoveAbility(gfx, 'Amrf')
     call SetUnitFlyHeight(gfx, dz, 0.)
     call UnitApplyTimedLife(gfx, 'BTLF', whichDuration)
     call DestroyEffect(AddSpecialEffectTarget(whichPath, gfx, "origin")
     call RemoveLocation(whichLoc)
        
     set gfx = null
     set whichLoc = null
endfunction

Warning: Not Tested!

'e000' is the rawcode of a dummy unit with no model nor attack/food cap/...
Note that whichDuration should be a bit longer than the effect itself.

When creating a Lightning Effect you simply use the native

Code
native AddLightningEx takes string codeName, boolean checkVisibility, real x1, real y1, real z1, real x2, real y2, real z2 returns lightning

There's also a native called AddLightning, which doesn't use the z coordinates.

A private constant variable:

First off all you should know what a constant variable is. A constant variable can only be defined in the editor. You cannot change these in-game. That's why it's called constant. You can only use private globals or constants in a scope or in a library.

Code
Library MessageLib
    private constant string Msg = "Hello World!"

    public function PrintMsg takes nothing returns nothing
      call BJDebugMsg(Msg)
    endfunction
endlibrary

Output: "Hello World!"

Code
function Print takes nothing returns nothing
   call BJDebugMsg(Msg)
endfunction

In this case the JassHelper ( Syntax Checker/Compiler ) would give you an error message because he cannot find the constant variable "Msg" because it's private. And thus it can only be used in the library MessageLib


 
TheCheeseLoverDate: Sunday, 2008-12-07, 7:49 PM | Message # 3
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Thanks :D. But when I put the native flying lightning, it's say there is an error.:( (I putted the flying lightning in the trigger's action)

Yay I have a signature. You suck. :D

Message edited by TheCheeseLover - Sunday, 2008-12-07, 7:53 PM
 
Darkt3mpl3rDate: Monday, 2008-12-08, 4:25 PM | Message # 4
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
Can you send me a code snippet ? That's the only way I can give exact solutions.

 
TheCheeseLoverDate: Tuesday, 2008-12-09, 2:05 AM | Message # 5
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Never mind! Sorry I sent this Saturday and I found the solution Sunday. biggrin

5: How make a function that will create some specials effects at real x, real y, real z, with a radius aoe, with a duration, with a delay, with a string code name and returns group (for the number of special effect).

Because I tryed this and it don't work, the world edit crash. (I think it's the group.)


Yay I have a signature. You suck. :D
 
Darkt3mpl3rDate: Wednesday, 2008-12-10, 6:41 PM | Message # 6
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
You better send me your code.

Why would you need to return a group ? group == at least one unit. For a number of created special effects count it with an integer and return an integer.

Btw, I don't really get your point. Express yourself a bit better.


 
TheCheeseLoverDate: Friday, 2008-12-12, 1:53 AM | Message # 7
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
I tryed with integer, but it crashed when I called it. sad

function test takes real x, real y, real z, real radius, real duration, real delay, string codeName returns integer
endfunction

local string s

set s = "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl"

call test(0, 0, 100, 200, 1, 0.01, s, 50)


Yay I have a signature. You suck. :D
 
Darkt3mpl3rDate: Friday, 2008-12-12, 2:59 PM | Message # 8
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
it is because you typed in wrong arguments for you function. and also the external function stuff is not in a function itself.
it should look like this

Code
function test takes real x, real y, real z, real radius, real duration, real delay, string codeName returns integer
  local integer i = 0

  // Your stuff here

  return i // <-- integer that MUST be returned.
endfunction

function RunTest takes nothing returns nothing
  local string s = "Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl"
  local integer i = test(0, 0, 100, 200, 1, 0.01, s)
endfunction


 
TheCheeseLoverDate: Friday, 2008-12-12, 3:43 PM | Message # 9
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
*It work ( no syntax error) but no effect was here. sad
What do I need to put at // your stuff here.

*
function Trig_explosion_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction

function test takes group g, real x0, real y0, real radius, real angle, real scale, real z, real delay, real duration, string modelName, integer number returns group
local group g = CreateGroup()

// Your stuff here

return g // <-- integer that MUST be returned.
endfunction

function Trig_explosion_Actions takes nothing returns nothing
local group g
local string s = "Abilities\\Weapons\\VengeanceMissile\\VengeanceMissile.mdl"
call test(g, 0.00, 0.00, 400.00, 45.00, 1.25, 50.00, 0.03, 0, s, 30)
endfunction

//===========================================================================
function InitTrig_explosion takes nothing returns nothing
set gg_trg_explosion = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_explosion, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_explosion, Condition( function Trig_explosion_Conditions ) )
call TriggerAddAction( gg_trg_explosion, function Trig_explosion_Actions )
call Preload("Objects\\Spawnmodels\\Human\\HCancelDeath\\HCancelDeath.mdl")
endfunction

How to make a JASS spell in MUI?

And THX! biggrin

+ 1 Darkt3mpl3r :D.


Yay I have a signature. You suck. :D

Message edited by TheCheeseLover - Saturday, 2008-12-13, 5:11 AM
 
Darkt3mpl3rDate: Saturday, 2008-12-13, 10:24 PM | Message # 10
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
First off,
you should know the basics of JASS.

Read through these workshops: http://www.wc3campaigns.net/showthread.php?t=71484 || http://www.wc3campaigns.net/showthread.php?t=74894

After that come back and check your code again. You'll see that there are several syntax errors.


 
TheCheeseLoverDate: Sunday, 2008-12-14, 0:13 AM | Message # 11
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
I know. It's the group but checked a system name Graphic System and it was almost that. So i don't how to do some thing like that (because it never work sad ) :

function test takes real x0, real y0, real radius, real angle, real scale, real z, real delay, real duration, string modelName returns integer number


Yay I have a signature. You suck. :D
 
Darkt3mpl3rDate: Sunday, 2008-12-14, 11:40 PM | Message # 12
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
Just read through the tutorials.

 
TheCheeseLoverDate: Saturday, 2008-12-20, 3:41 PM | Message # 13
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
Sorry but I don't found it. sad ( I will cry ''sniff'')

Added (2008-12-20, 3:41 Pm)
---------------------------------------------
Can you help me to do it? biggrin


Yay I have a signature. You suck. :D
 
Darkt3mpl3rDate: Sunday, 2008-12-21, 0:07 AM | Message # 14
Sergeant
Group: Administrators
Messages: 35
Reputation: 4
Status: Offline
No I can't. I don't even know what you're trying to do. all I can say the first line of code should look like this.

Code

function test takes real x0, real y0, real radius, real angle, real scale, real z, real delay, real duration, string modelName returns integer

in the return you simply write down the handle that should be returned. Do not write any name behind the handle.


 
TheCheeseLoverDate: Sunday, 2008-12-21, 0:38 AM | Message # 15
Sergeant
Group: Users
Messages: 22
Reputation: 0
Status: Offline
The only thing that I am trying to do is to create a SFX at postion of real x, y and z, in a radius aoe, between the SFX there will have an angle and change the scale of them.

BUT IT DON'T WORK!

Thanks!

Now can you help me please?


Yay I have a signature. You suck. :D
 
Clan NgO Forums » Discussions » Flood Dimension » Question to the teacher. :) (Some questions)
  • Page 1 of 2
  • 1
  • 2
  • »
Search:

Clan NgO © 2024Powered by uCoz